Java Code Examples for net.minecraft.world.chunk.ChunkPrimer

The following are top voted examples for showing how to use net.minecraft.world.chunk.ChunkPrimer. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Genesis   File: GenesisChunkGenerator.java   Source Code and License 6 votes vote down vote up
private void generateBlocks(ChunkPrimer primer, int chunkX, int chunkZ) {
    // TODO: replace with some actual non-superflat terrain generation
    for (int localX = 0; localX < CHUNK_SIZE; localX++) {
        for (int localZ = 0; localZ < CHUNK_SIZE; localZ++) {
            primer.setBlockState(localX, 0, localZ, BlockStates.BEDROCK);
            for (int blockY = 1; blockY < 64; blockY++) {
                IBlockState state = BlockStates.STONE;
                if (blockY == 63) {
                    state = BlockStates.GRASS;
                } else if (blockY >= 60) {
                    state = BlockStates.DIRT;
                }
                primer.setBlockState(localX, blockY, localZ, state);
            }
        }
    }
}
 
Example 2
Project: Backmemed   File: BiomeHills.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
{
    this.topBlock = Blocks.GRASS.getDefaultState();
    this.fillerBlock = Blocks.DIRT.getDefaultState();

    if ((noiseVal < -1.0D || noiseVal > 2.0D) && this.type == BiomeHills.Type.MUTATED)
    {
        this.topBlock = Blocks.GRAVEL.getDefaultState();
        this.fillerBlock = Blocks.GRAVEL.getDefaultState();
    }
    else if (noiseVal > 1.0D && this.type != BiomeHills.Type.EXTRA_TREES)
    {
        this.topBlock = Blocks.STONE.getDefaultState();
        this.fillerBlock = Blocks.STONE.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
}
 
Example 3
Project: harshencastle   File: PontusChunkProvider.java   Source Code and License 6 votes vote down vote up
/**
 * Generates the chunk at the specified position, from scratch
 */
public Chunk generateChunk(int x, int z)
{	
    this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.setBlocksInChunk(x, z, chunkprimer);

    this.replaceBiomeBlocks(x, z, chunkprimer, PontusBiomeProvider.biomeFromPosition(x, z));
    
    this.caveGenerator.generate(this.world, x, z, chunkprimer);
    this.ravineGenerator.generate(this.world, x, z, chunkprimer);

    NoodleEvent event = new NoodleEvent(this, world, x, z, chunkprimer);
    MinecraftForge.EVENT_BUS.post(event);
    chunkprimer = event.getPrimer();
    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    
    
    chunk.generateSkylightMap();
    return chunk;
}
 
Example 4
Project: Backmemed   File: ChunkProviderEnd.java   Source Code and License 6 votes vote down vote up
public Chunk provideChunk(int x, int z)
{
    this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.setBlocksInChunk(x, z, chunkprimer);
    this.buildSurfaces(chunkprimer);

    if (this.mapFeaturesEnabled)
    {
        this.endCityGen.generate(this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]);
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 5
Project: BaseClient   File: MapGenBase.java   Source Code and License 6 votes vote down vote up
public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn)
{
    int i = this.range;
    this.worldObj = worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();

    for (int l = x - i; l <= x + i; ++l)
    {
        for (int i1 = z - i; i1 <= z + i; ++i1)
        {
            long j1 = (long)l * j;
            long k1 = (long)i1 * k;
            this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
            this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn);
        }
    }
}
 
Example 6
Project: DecompiledMinecraft   File: BiomeGenSavanna.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    this.topBlock = Blocks.grass.getDefaultState();
    this.fillerBlock = Blocks.dirt.getDefaultState();

    if (p_180622_6_ > 1.75D)
    {
        this.topBlock = Blocks.stone.getDefaultState();
        this.fillerBlock = Blocks.stone.getDefaultState();
    }
    else if (p_180622_6_ > -0.5D)
    {
        this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 7
Project: DecompiledMinecraft   File: BiomeGenTaiga.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
    {
        this.topBlock = Blocks.grass.getDefaultState();
        this.fillerBlock = Blocks.dirt.getDefaultState();

        if (p_180622_6_ > 1.75D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
        }
        else if (p_180622_6_ > -0.95D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 8
Project: DecompiledMinecraft   File: BiomeGenHills.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    this.topBlock = Blocks.grass.getDefaultState();
    this.fillerBlock = Blocks.dirt.getDefaultState();

    if ((p_180622_6_ < -1.0D || p_180622_6_ > 2.0D) && this.field_150638_aH == this.field_150637_aG)
    {
        this.topBlock = Blocks.gravel.getDefaultState();
        this.fillerBlock = Blocks.gravel.getDefaultState();
    }
    else if (p_180622_6_ > 1.0D && this.field_150638_aH != this.field_150636_aF)
    {
        this.topBlock = Blocks.stone.getDefaultState();
        this.fillerBlock = Blocks.stone.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 9
Project: CustomWorldGen   File: BiomeSavannaMutated.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
{
    this.topBlock = Blocks.GRASS.getDefaultState();
    this.fillerBlock = Blocks.DIRT.getDefaultState();

    if (noiseVal > 1.75D)
    {
        this.topBlock = Blocks.STONE.getDefaultState();
        this.fillerBlock = Blocks.STONE.getDefaultState();
    }
    else if (noiseVal > -0.5D)
    {
        this.topBlock = Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
}
 
Example 10
Project: CustomWorldGen   File: MapGenCaves.java   Source Code and License 6 votes vote down vote up
/**
 * Digs out the current block, default implementation removes stone, filler, and top block
 * Sets the block to lava if y is less then 10, and air other wise.
 * If setting to air, it also checks to see if we've broken the surface and if so
 * tries to make the floor the biome's top block
 *
 * @param data Block data array
 * @param index Pre-calculated index into block data
 * @param x local X position
 * @param y local Y position
 * @param z local Z position
 * @param chunkX Chunk X position
 * @param chunkZ Chunk Y position
 * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
 */
protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up)
{
    net.minecraft.world.biome.Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    IBlockState top = biome.topBlock;
    IBlockState filler = biome.fillerBlock;

    if (this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock())
    {
        if (y - 1 < 10)
        {
            data.setBlockState(x, y, z, BLK_LAVA);
        }
        else
        {
            data.setBlockState(x, y, z, BLK_AIR);

            if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
            {
                data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
            }
        }
    }
}
 
Example 11
Project: Backmemed   File: MapGenBase.java   Source Code and License 6 votes vote down vote up
public void generate(World worldIn, int x, int z, ChunkPrimer primer)
{
    int i = this.range;
    this.worldObj = worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();

    for (int l = x - i; l <= x + i; ++l)
    {
        for (int i1 = z - i; i1 <= z + i; ++i1)
        {
            long j1 = (long)l * j;
            long k1 = (long)i1 * k;
            this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
            this.recursiveGenerate(worldIn, l, i1, x, z, primer);
        }
    }
}
 
Example 12
Project: DecompiledMinecraft   File: MapGenBase.java   Source Code and License 6 votes vote down vote up
public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn)
{
    int i = this.range;
    this.worldObj = worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();

    for (int l = x - i; l <= x + i; ++l)
    {
        for (int i1 = z - i; i1 <= z + i; ++i1)
        {
            long j1 = (long)l * j;
            long k1 = (long)i1 * k;
            this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
            this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn);
        }
    }
}
 
Example 13
Project: DecompiledMinecraft   File: MapGenRavine.java   Source Code and License 6 votes vote down vote up
/**
 * Recursively called by generate()
 */
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
{
    if (this.rand.nextInt(50) == 0)
    {
        double d0 = (double)(chunkX * 16 + this.rand.nextInt(16));
        double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
        double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16));
        int i = 1;

        for (int j = 0; j < i; ++j)
        {
            float f = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
            float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F;
            this.func_180707_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D);
        }
    }
}
 
Example 14
Project: CustomWorldGen   File: MapGenRavine.java   Source Code and License 6 votes vote down vote up
/**
 * Recursively called by generate()
 */
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
{
    if (this.rand.nextInt(50) == 0)
    {
        double d0 = (double)(chunkX * 16 + this.rand.nextInt(16));
        double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
        double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16));
        int i = 1;

        for (int j = 0; j < 1; ++j)
        {
            float f = this.rand.nextFloat() * ((float)Math.PI * 2F);
            float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
            float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F;
            this.addTunnel(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D);
        }
    }
}
 
Example 15
Project: BaseClient   File: ChunkProviderEnd.java   Source Code and License 6 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.func_180520_a(x, z, chunkprimer);
    this.func_180519_a(chunkprimer);
    Chunk chunk = new Chunk(this.endWorld, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)this.biomesForGeneration[i].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 16
Project: DecompiledMinecraft   File: BiomeGenTaiga.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
    {
        this.topBlock = Blocks.grass.getDefaultState();
        this.fillerBlock = Blocks.dirt.getDefaultState();

        if (p_180622_6_ > 1.75D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
        }
        else if (p_180622_6_ > -0.95D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 17
Project: CustomWorldGen   File: MapGenRavine.java   Source Code and License 6 votes vote down vote up
/**
 * Digs out the current block, default implementation removes stone, filler, and top block
 * Sets the block to lava if y is less then 10, and air other wise.
 * If setting to air, it also checks to see if we've broken the surface and if so
 * tries to make the floor the biome's top block
 *
 * @param data Block data array
 * @param index Pre-calculated index into block data
 * @param x local X position
 * @param y local Y position
 * @param z local Z position
 * @param chunkX Chunk X position
 * @param chunkZ Chunk Y position
 * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface.
 */
protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop)
{
    net.minecraft.world.biome.Biome biome = worldObj.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    IBlockState state = data.getBlockState(x, y, z);
    IBlockState top = isExceptionBiome(biome) ? Blocks.GRASS.getDefaultState() : biome.topBlock;
    IBlockState filler = isExceptionBiome(biome) ? Blocks.DIRT.getDefaultState() : biome.fillerBlock;

    if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock())
    {
        if (y - 1 < 10)
        {
            data.setBlockState(x, y, z, FLOWING_LAVA);
        }
        else
        {
            data.setBlockState(x, y, z, AIR);

            if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock())
            {
                data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState());
            }
        }
    }
}
 
Example 18
Project: DecompiledMinecraft   File: BiomeGenHills.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    this.topBlock = Blocks.grass.getDefaultState();
    this.fillerBlock = Blocks.dirt.getDefaultState();

    if ((p_180622_6_ < -1.0D || p_180622_6_ > 2.0D) && this.field_150638_aH == this.field_150637_aG)
    {
        this.topBlock = Blocks.gravel.getDefaultState();
        this.fillerBlock = Blocks.gravel.getDefaultState();
    }
    else if (p_180622_6_ > 1.0D && this.field_150638_aH != this.field_150636_aF)
    {
        this.topBlock = Blocks.stone.getDefaultState();
        this.fillerBlock = Blocks.stone.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 19
Project: BaseClient   File: MapGenBase.java   Source Code and License 6 votes vote down vote up
public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn)
{
    int i = this.range;
    this.worldObj = worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();

    for (int l = x - i; l <= x + i; ++l)
    {
        for (int i1 = z - i; i1 <= z + i; ++i1)
        {
            long j1 = (long)l * j;
            long k1 = (long)i1 * k;
            this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
            this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn);
        }
    }
}
 
Example 20
Project: BaseClient   File: MapGenRavine.java   Source Code and License 6 votes vote down vote up
/**
 * Recursively called by generate()
 */
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
{
    if (this.rand.nextInt(50) == 0)
    {
        double d0 = (double)(chunkX * 16 + this.rand.nextInt(16));
        double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20);
        double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16));
        int i = 1;

        for (int j = 0; j < i; ++j)
        {
            float f = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
            float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F;
            this.func_180707_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D);
        }
    }
}
 
Example 21
Project: DecompiledMinecraft   File: MapGenBase.java   Source Code and License 6 votes vote down vote up
public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn)
{
    int i = this.range;
    this.worldObj = worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();

    for (int l = x - i; l <= x + i; ++l)
    {
        for (int i1 = z - i; i1 <= z + i; ++i1)
        {
            long j1 = (long)l * j;
            long k1 = (long)i1 * k;
            this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed());
            this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn);
        }
    }
}
 
Example 22
Project: CustomWorldGen   File: ChunkProviderHell.java   Source Code and License 6 votes vote down vote up
public Chunk provideChunk(int x, int z)
{
    this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.prepareHeights(x, z, chunkprimer);
    this.buildSurfaces(x, z, chunkprimer);
    this.genNetherCaves.generate(this.world, x, z, chunkprimer);

    if (this.generateStructures)
    {
        this.genNetherBridge.generate(this.world, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    Biome[] abiome = this.world.getBiomeProvider().getBiomes((Biome[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)Biome.getIdForBiome(abiome[i]);
    }

    chunk.resetRelightChecks();
    return chunk;
}
 
Example 23
Project: DecompiledMinecraft   File: ChunkProviderEnd.java   Source Code and License 6 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    this.func_180520_a(x, z, chunkprimer);
    this.func_180519_a(chunkprimer);
    Chunk chunk = new Chunk(this.endWorld, chunkprimer, x, z);
    byte[] abyte = chunk.getBiomeArray();

    for (int i = 0; i < abyte.length; ++i)
    {
        abyte[i] = (byte)this.biomesForGeneration[i].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 24
Project: BaseClient   File: BiomeGenTaiga.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    if (this.field_150644_aH == 1 || this.field_150644_aH == 2)
    {
        this.topBlock = Blocks.grass.getDefaultState();
        this.fillerBlock = Blocks.dirt.getDefaultState();

        if (p_180622_6_ > 1.75D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
        }
        else if (p_180622_6_ > -0.95D)
        {
            this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL);
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 25
Project: BaseClient   File: BiomeGenHills.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    this.topBlock = Blocks.grass.getDefaultState();
    this.fillerBlock = Blocks.dirt.getDefaultState();

    if ((p_180622_6_ < -1.0D || p_180622_6_ > 2.0D) && this.field_150638_aH == this.field_150637_aG)
    {
        this.topBlock = Blocks.gravel.getDefaultState();
        this.fillerBlock = Blocks.gravel.getDefaultState();
    }
    else if (p_180622_6_ > 1.0D && this.field_150638_aH != this.field_150636_aF)
    {
        this.topBlock = Blocks.stone.getDefaultState();
        this.fillerBlock = Blocks.stone.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 26
Project: modName   File: BiomeScrubland.java   Source Code and License 6 votes vote down vote up
@Override
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal)
{
    this.topBlock = Blocks.GRASS.getDefaultState();
    this.fillerBlock = Blocks.DIRT.getDefaultState();

    double fuzz = MathUtil.getFuzz(x,z, 342453747);
    if (noiseVal + fuzz * 2 > 1.85) {
        this.topBlock = Blocks.SAND.getDefaultState();
        this.fillerBlock = Blocks.SAND.getDefaultState();
    } else if( noiseVal + fuzz * 2 < -1.85) {
        this.topBlock = Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT);
        this.fillerBlock = Blocks.DIRT.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, x, z, noiseVal);
}
 
Example 27
Project: BaseClient   File: BiomeGenHills.java   Source Code and License 6 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    this.topBlock = Blocks.grass.getDefaultState();
    this.fillerBlock = Blocks.dirt.getDefaultState();

    if ((p_180622_6_ < -1.0D || p_180622_6_ > 2.0D) && this.field_150638_aH == this.field_150637_aG)
    {
        this.topBlock = Blocks.gravel.getDefaultState();
        this.fillerBlock = Blocks.gravel.getDefaultState();
    }
    else if (p_180622_6_ > 1.0D && this.field_150638_aH != this.field_150636_aF)
    {
        this.topBlock = Blocks.stone.getDefaultState();
        this.fillerBlock = Blocks.stone.getDefaultState();
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 28
Project: Firma   File: FirmaGenRavine.java   Source Code and License 5 votes vote down vote up
private static boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ)
{
	return false;
    //net.minecraft.world.biome.Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16));
    //IBlockState state = data.getBlockState(x, y, z);
    //return (isExceptionBiome(biome) ? Util.isGrass(state.getBlock()) : state.getBlock() == biome.topBlock);
}
 
Example 29
Project: CustomWorldGen   File: ChunkProviderFlat.java   Source Code and License 5 votes vote down vote up
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    Biome[] abiome = this.worldObj.getBiomeProvider().getBiomes((Biome[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)Biome.getIdForBiome(abiome[l]);
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 30
Project: DecompiledMinecraft   File: BiomeGenSwamp.java   Source Code and License 5 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    double d0 = GRASS_COLOR_NOISE.func_151601_a((double)p_180622_4_ * 0.25D, (double)p_180622_5_ * 0.25D);

    if (d0 > 0.0D)
    {
        int i = p_180622_4_ & 15;
        int j = p_180622_5_ & 15;

        for (int k = 255; k >= 0; --k)
        {
            if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air)
            {
                if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water)
                {
                    chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState());

                    if (d0 < 0.12D)
                    {
                        chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState());
                    }
                }

                break;
            }
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 31
Project: BaseClient   File: ChunkProviderDebug.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            int k = x * 16 + i;
            int l = z * 16 + j;
            chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState());
            IBlockState iblockstate = func_177461_b(k, l);

            if (iblockstate != null)
            {
                chunkprimer.setBlockState(i, 70, j, iblockstate);
            }
        }
    }

    Chunk chunk = new Chunk(this.world, chunkprimer, x, z);
    chunk.generateSkylightMap();
    BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int i1 = 0; i1 < abyte.length; ++i1)
    {
        abyte[i1] = (byte)abiomegenbase[i1].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 32
Project: DecompiledMinecraft   File: ChunkProviderGenerate.java   Source Code and License 5 votes vote down vote up
public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_)
{
    if (this.settings.useMineShafts && this.mapFeaturesEnabled)
    {
        this.mineshaftGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useVillages && this.mapFeaturesEnabled)
    {
        this.villageGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useStrongholds && this.mapFeaturesEnabled)
    {
        this.strongholdGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useTemples && this.mapFeaturesEnabled)
    {
        this.scatteredFeatureGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useMonuments && this.mapFeaturesEnabled)
    {
        this.oceanMonumentGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }
}
 
Example 33
Project: BaseClient   File: ChunkProviderGenerate.java   Source Code and License 5 votes vote down vote up
public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_)
{
    if (this.settings.useMineShafts && this.mapFeaturesEnabled)
    {
        this.mineshaftGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useVillages && this.mapFeaturesEnabled)
    {
        this.villageGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useStrongholds && this.mapFeaturesEnabled)
    {
        this.strongholdGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useTemples && this.mapFeaturesEnabled)
    {
        this.scatteredFeatureGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }

    if (this.settings.useMonuments && this.mapFeaturesEnabled)
    {
        this.oceanMonumentGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }
}
 
Example 34
Project: DecompiledMinecraft   File: BiomeGenSwamp.java   Source Code and License 5 votes vote down vote up
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_)
{
    double d0 = GRASS_COLOR_NOISE.func_151601_a((double)p_180622_4_ * 0.25D, (double)p_180622_5_ * 0.25D);

    if (d0 > 0.0D)
    {
        int i = p_180622_4_ & 15;
        int j = p_180622_5_ & 15;

        for (int k = 255; k >= 0; --k)
        {
            if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air)
            {
                if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water)
                {
                    chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState());

                    if (d0 < 0.12D)
                    {
                        chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState());
                    }
                }

                break;
            }
        }
    }

    this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_);
}
 
Example 35
Project: Backmemed   File: ChunkProviderOverworld.java   Source Code and License 5 votes vote down vote up
public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, Biome[] biomesIn)
{
    double d0 = 0.03125D;
    this.depthBuffer = this.surfaceNoise.getRegion(this.depthBuffer, (double)(x * 16), (double)(z * 16), 16, 16, 0.0625D, 0.0625D, 1.0D);

    for (int i = 0; i < 16; ++i)
    {
        for (int j = 0; j < 16; ++j)
        {
            Biome biome = biomesIn[j + i * 16];
            biome.genTerrainBlocks(this.worldObj, this.rand, primer, x * 16 + i, z * 16 + j, this.depthBuffer[j + i * 16]);
        }
    }
}
 
Example 36
Project: Backmemed   File: MapGenCaves.java   Source Code and License 5 votes vote down vote up
/**
 * Recursively called by generate()
 */
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
{
    int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(15) + 1) + 1);

    if (this.rand.nextInt(7) != 0)
    {
        i = 0;
    }

    for (int j = 0; j < i; ++j)
    {
        double d0 = (double)(chunkX * 16 + this.rand.nextInt(16));
        double d1 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8);
        double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16));
        int k = 1;

        if (this.rand.nextInt(4) == 0)
        {
            this.addRoom(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2);
            k += this.rand.nextInt(4);
        }

        for (int l = 0; l < k; ++l)
        {
            float f = this.rand.nextFloat() * ((float)Math.PI * 2F);
            float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
            float f2 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat();

            if (this.rand.nextInt(10) == 0)
            {
                f2 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F;
            }

            this.addTunnel(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 1.0D);
        }
    }
}
 
Example 37
Project: modName   File: ChunkProviderBasic.java   Source Code and License 5 votes vote down vote up
public void fillChunk(int chunkX, int chunkZ, ChunkPrimer primer) {
    IBlockState iblockstate = Blocks.STONE.getDefaultState();
    for (int iy = 0; iy < 64; ++iy)
    {
        for (int ix = 0; ix < 16; ++ix)
        {
            for (int iz = 0; iz < 16; ++iz)
            {
                primer.setBlockState(ix, iy, iz, iblockstate);
            }
        }
    }
}
 
Example 38
Project: DecompiledMinecraft   File: MapGenCaves.java   Source Code and License 5 votes vote down vote up
/**
 * Recursively called by generate()
 */
protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn)
{
    int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(15) + 1) + 1);

    if (this.rand.nextInt(7) != 0)
    {
        i = 0;
    }

    for (int j = 0; j < i; ++j)
    {
        double d0 = (double)(chunkX * 16 + this.rand.nextInt(16));
        double d1 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8);
        double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16));
        int k = 1;

        if (this.rand.nextInt(4) == 0)
        {
            this.func_180703_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2);
            k += this.rand.nextInt(4);
        }

        for (int l = 0; l < k; ++l)
        {
            float f = this.rand.nextFloat() * (float)Math.PI * 2.0F;
            float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F;
            float f2 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat();

            if (this.rand.nextInt(10) == 0)
            {
                f2 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F;
            }

            this.func_180702_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 1.0D);
        }
    }
}
 
Example 39
Project: DecompiledMinecraft   File: ChunkProviderFlat.java   Source Code and License 5 votes vote down vote up
/**
 * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
 * specified chunk from the map seed and chunk seed
 */
public Chunk provideChunk(int x, int z)
{
    ChunkPrimer chunkprimer = new ChunkPrimer();

    for (int i = 0; i < this.cachedBlockIDs.length; ++i)
    {
        IBlockState iblockstate = this.cachedBlockIDs[i];

        if (iblockstate != null)
        {
            for (int j = 0; j < 16; ++j)
            {
                for (int k = 0; k < 16; ++k)
                {
                    chunkprimer.setBlockState(j, i, k, iblockstate);
                }
            }
        }
    }

    for (MapGenBase mapgenbase : this.structureGenerators)
    {
        mapgenbase.generate(this, this.worldObj, x, z, chunkprimer);
    }

    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int l = 0; l < abyte.length; ++l)
    {
        abyte[l] = (byte)abiomegenbase[l].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example 40
Project: DecompiledMinecraft   File: ChunkProviderFlat.java   Source Code and License 5 votes vote down vote up
public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_)
{
    for (MapGenStructure mapgenstructure : this.structureGenerators)
    {
        mapgenstructure.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
    }
}