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);
}
}
}
}
}
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);
}
}
}
}
}
Aggregations