net.minecraft.world.gen.ChunkRandom Java Examples

The following examples show how to use net.minecraft.world.gen.ChunkRandom. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoonChunkGenerator.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
public MoonChunkGenerator(MoonBiomeSource biomeSource, long seed) {
    super(biomeSource, biomeSource, new StructuresConfig(false), seed);
    this.seed = seed;
    this.chunkGeneratorType = new ChunkGeneratorType(new StructuresConfig(false), new NoiseConfig(256, new NoiseSamplingConfig(0.9999999814507745D, 0.9999999814507745D, 80.0D, 160.0D), new SlideConfig(-10, 3, 0), new SlideConfig(-30, 0, 0), 1, 2, 1.0D, -0.46875D, true, true, false, false), Blocks.STONE.getDefaultState(), Blocks.WATER.getDefaultState(), -10, 0, 63, false);
    NoiseConfig noiseConfig = chunkGeneratorType.method_28559();
    this.field_24779 = noiseConfig.getHeight();
    this.verticalNoiseResolution = noiseConfig.getSizeVertical() * 4;
    this.horizontalNoiseResolution = noiseConfig.getSizeHorizontal() * 4;
    this.defaultBlock = chunkGeneratorType.getDefaultBlock();
    this.defaultFluid = chunkGeneratorType.getDefaultFluid();
    this.noiseSizeX = 16 / this.horizontalNoiseResolution;
    this.noiseSizeY = noiseConfig.getHeight() / this.verticalNoiseResolution;
    this.noiseSizeZ = 16 / this.horizontalNoiseResolution;
    this.random = new ChunkRandom(seed);
    this.lowerInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
    this.upperInterpolatedNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
    this.interpolationNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-7, 0));
    this.surfaceDepthNoise = new OctaveSimplexNoiseSampler(this.random, IntStream.rangeClosed(-3, 0));
    this.random.consume(2620);
    this.field_24776 = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0));
}
 
Example #2
Source File: MoonChunkGenerator.java    From Galacticraft-Rewoven with MIT License 6 votes vote down vote up
public void buildSurface(ChunkRegion region, Chunk chunk) {
    ChunkPos chunkPos = chunk.getPos();
    int i = chunkPos.x;
    int j = chunkPos.z;
    ChunkRandom chunkRandom = new ChunkRandom();
    chunkRandom.setTerrainSeed(i, j);
    ChunkPos chunkPos2 = chunk.getPos();
    int k = chunkPos2.getStartX();
    int l = chunkPos2.getStartZ();
    BlockPos.Mutable mutable = new BlockPos.Mutable();

    for (int m = 0; m < 16; ++m) {
        for (int n = 0; n < 16; ++n) {
            int o = k + m;
            int p = l + n;
            int q = chunk.sampleHeightmap(Heightmap.Type.WORLD_SURFACE_WG, m, n) + 1;
            double e = this.surfaceDepthNoise.sample((double) o * 0.0625D, (double) p * 0.0625D, 0.0625D, (double) m * 0.0625D) * 15.0D;
            region.getBiome(mutable.set(k + m, q, l + n)).buildSurface(chunkRandom, chunk, o, p, q, e, this.defaultBlock, this.defaultFluid, this.getSeaLevel(), region.getSeed());
        }
    }

    this.buildBedrock(chunk, chunkRandom);

    buildCraters(chunk, region);
}
 
Example #3
Source File: FeatureGenerator.java    From fabric-carpet with MIT License 6 votes vote down vote up
public static StructureStart shouldStructureStartAt(ServerWorld world, BlockPos pos, StructureFeature<?> structure, boolean computeBox)
{
    ChunkGenerator<?> generator = world.getChunkManager().getChunkGenerator();
    if (!generator.getBiomeSource().hasStructureFeature(structure))
        return null;
    BiomeAccess biomeAccess = world.getBiomeAccess().withSource(generator.getBiomeSource());
    ChunkRandom chunkRandom = new ChunkRandom();
    ChunkPos chunkPos = new ChunkPos(pos);
    Biome biome = biomeAccess.getBiome(new BlockPos(chunkPos.getStartX() + 9, 0, chunkPos.getStartZ() + 9));
    if (structure.shouldStartAt(biomeAccess, generator, chunkRandom, chunkPos.x, chunkPos.z, biome))
    {
        if (!computeBox) return StructureStart.DEFAULT;
        StructureManager manager = world.getSaveHandler().getStructureManager();
        StructureStart structureStart3 = structure.getStructureStartFactory().create(structure, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, generator.getSeed());
        structureStart3.initialize(generator, manager, chunkPos.x, chunkPos.z, biome);
        if (!structureStart3.hasChildren()) return null;
        return structureStart3;
    }
    return null;
}
 
Example #4
Source File: MoonChunkGenerator.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
public void populateEntities(ChunkRegion region) {
    int i = region.getCenterChunkX();
    int j = region.getCenterChunkZ();
    Biome biome = region.getBiome((new ChunkPos(i, j)).getCenterBlockPos());
    ChunkRandom chunkRandom = new ChunkRandom();
    chunkRandom.setPopulationSeed(region.getSeed(), i << 4, j << 4);
    SpawnHelper.populateEntities(region, biome, i, j, chunkRandom);
}
 
Example #5
Source File: HallowedChunkGenerator.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
public void populateEntities(ChunkRegion region) {
	int centreX = region.getCenterChunkX();
	int centreZ = region.getCenterChunkZ();
	Biome biome = region.getBiome((new ChunkPos(centreX, centreZ)).getCenterBlockPos());
	ChunkRandom chunkRandom = new ChunkRandom();
	chunkRandom.setSeed(region.getSeed(), centreX << 4, centreZ << 4);
	SpawnHelper.populateEntities(region, biome, centreX, centreZ, chunkRandom);
}