Search in sources :

Example 11 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class ChunkGeneratorCavenia method replaceBiomeBlocks.

public void replaceBiomeBlocks(int chunkX, int chunkZ, ChunkPrimer primer) {
    if (!ForgeEventFactory.onReplaceBiomeBlocks(this, chunkX, chunkZ, primer, world)) {
        return;
    }
    int worldHeight = world.provider.getActualHeight();
    int blockHeight = worldHeight - 1;
    for (int x = 0; x < 16; ++x) {
        for (int z = 0; z < 16; ++z) {
            Biome biome = biomesForGeneration[x * 16 + z];
            CaveBiome caveBiome = CaveniaConfig.biomeManager.getCaveBiome(biome);
            IBlockState top = caveBiome == null ? STONE : caveBiome.getTopBlock().getBlockState();
            IBlockState filter = caveBiome == null ? top : caveBiome.getTerrainBlock().getBlockState();
            primer.setBlockState(x, 0, z, BEDROCK);
            primer.setBlockState(x, blockHeight, z, BEDROCK);
            for (int y = 1; y <= blockHeight - 1; ++y) {
                if (primer.getBlockState(x, y, z).getMaterial().isSolid() && primer.getBlockState(x, y + 1, z).getBlock() == Blocks.AIR) {
                    primer.setBlockState(x, y, z, top);
                } else if (primer.getBlockState(x, y, z).getBlock() == Blocks.STONE) {
                    primer.setBlockState(x, y, z, filter);
                }
            }
            if (blockHeight < 255) {
                for (int y = blockHeight + 1; y < 256; ++y) {
                    primer.setBlockState(x, y, z, AIR);
                }
            }
        }
    }
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) Biome(net.minecraft.world.biome.Biome) IBlockState(net.minecraft.block.state.IBlockState) CaveBiome(cavern.config.manager.CaveBiome)

Example 12 with CaveBiome

use of cavern.config.manager.CaveBiome in project Cavern2 by kegare.

the class ChunkGeneratorAquaCavern method replaceBiomeBlocks.

public void replaceBiomeBlocks(int chunkX, int chunkZ, ChunkPrimer primer) {
    if (!ForgeEventFactory.onReplaceBiomeBlocks(this, chunkX, chunkZ, primer, world)) {
        return;
    }
    int worldHeight = world.provider.getActualHeight();
    int blockHeight = worldHeight - 1;
    for (int x = 0; x < 16; ++x) {
        for (int z = 0; z < 16; ++z) {
            Biome biome = biomesForGeneration[x * 16 + z];
            CaveBiome caveBiome = AquaCavernConfig.biomeManager.getCaveBiome(biome);
            IBlockState top = caveBiome == null ? STONE : caveBiome.getTopBlock().getBlockState();
            IBlockState filter = caveBiome == null ? top : caveBiome.getTerrainBlock().getBlockState();
            primer.setBlockState(x, 0, z, BEDROCK);
            primer.setBlockState(x, blockHeight, z, BEDROCK);
            for (int y = 1; y <= blockHeight - 1; ++y) {
                if (primer.getBlockState(x, y, z).getMaterial().isSolid() && primer.getBlockState(x, y + 1, z).getMaterial().isLiquid()) {
                    primer.setBlockState(x, y, z, top);
                } else if (primer.getBlockState(x, y, z).getBlock() == Blocks.STONE) {
                    primer.setBlockState(x, y, z, filter);
                }
            }
            if (blockHeight < 255) {
                for (int y = blockHeight + 1; y < 256; ++y) {
                    primer.setBlockState(x, y, z, AIR);
                }
            }
        }
    }
}
Also used : CaveBiome(cavern.config.manager.CaveBiome) Biome(net.minecraft.world.biome.Biome) IBlockState(net.minecraft.block.state.IBlockState) CaveBiome(cavern.config.manager.CaveBiome)

Aggregations

CaveBiome (cavern.config.manager.CaveBiome)12 Biome (net.minecraft.world.biome.Biome)7 BlockMeta (cavern.util.BlockMeta)5 IBlockState (net.minecraft.block.state.IBlockState)4 List (java.util.List)2 File (java.io.File)1 IOException (java.io.IOException)1 Block (net.minecraft.block.Block)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 ConfigCategory (net.minecraftforge.common.config.ConfigCategory)1 Property (net.minecraftforge.common.config.Property)1