use of cavern.world.gen.WorldGenTreesPerverted in project Cavern2 by kegare.
the class ChunkGeneratorCaveland method populate.
@Override
public void populate(int chunkX, int chunkZ) {
BlockFalling.fallInstantly = true;
int worldX = chunkX * 16;
int worldZ = chunkZ * 16;
BlockPos blockPos = new BlockPos(worldX, 0, worldZ);
Biome biome = world.getBiome(blockPos.add(16, 0, 16));
BiomeDecorator decorator = biome.decorator;
int worldHeight = world.provider.getActualHeight();
ForgeEventFactory.onChunkPopulate(true, this, world, rand, chunkX, chunkZ, false);
int x, y, z;
if (CavelandConfig.generateLakes) {
if (TerrainGen.populate(this, world, rand, chunkX, chunkZ, false, EventType.LAKE)) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 16);
z = rand.nextInt(16) + 8;
lakeWaterGen.generate(world, rand, blockPos.add(x, y, z));
}
if (rand.nextInt(30) == 0 && TerrainGen.populate(this, world, rand, chunkX, chunkZ, false, EventType.LAVA)) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight / 2);
z = rand.nextInt(16) + 8;
lakeLavaGen.generate(world, rand, blockPos.add(x, y, z));
}
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(world, rand, blockPos));
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(world, rand, blockPos));
for (int i = 0; i < 10; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 10);
z = rand.nextInt(16) + 8;
acresiaGen.generate(world, rand, blockPos.add(x, y, z));
}
for (int i = 0; i < 15; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight / 2 - 10) + worldHeight / 2;
z = rand.nextInt(16) + 8;
acresiaGen.generate(world, rand, blockPos.add(x, y, z));
}
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.SHROOM)) {
for (int i = 0; i < 5; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 10);
z = rand.nextInt(16) + 8;
decorator.mushroomBrownGen.generate(world, rand, blockPos.add(x, y, z));
}
for (int i = 0; i < 5; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 10);
z = rand.nextInt(16) + 8;
decorator.mushroomRedGen.generate(world, rand, blockPos.add(x, y, z));
}
}
if (BiomeDictionary.hasType(biome, Type.SANDY)) {
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.CACTUS)) {
for (int i = 0; i < 80; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 5);
z = rand.nextInt(16) + 8;
decorator.cactusGen.generate(world, rand, blockPos.add(x, y, z));
}
}
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.DEAD_BUSH)) {
for (int i = 0; i < 10; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 5);
z = rand.nextInt(16) + 8;
deadBushGen.generate(world, rand, blockPos.add(x, y, z));
}
}
} else {
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.FLOWERS)) {
for (int i = 0; i < 8; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 5);
z = rand.nextInt(16) + 8;
decorator.flowerGen.generate(world, rand, blockPos.add(x, y, z));
}
}
for (int i = 0; i < 18; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight - 5);
z = rand.nextInt(16) + 8;
biome.getRandomWorldGenForGrass(rand).generate(world, rand, blockPos.add(x, y, z));
}
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.TREE)) {
WorldGenAbstractTree treeGen = null;
if (BiomeDictionary.hasType(biome, Type.JUNGLE)) {
treeGen = new WorldGenTreesPerverted(false, 4 + rand.nextInt(7), BlockPlanks.EnumType.JUNGLE, true);
} else if (BiomeDictionary.hasType(biome, Type.FOREST) || !BiomeDictionary.hasType(biome, Type.PLAINS) || rand.nextInt(10) == 0) {
if (BiomeDictionary.hasType(biome, Type.COLD)) {
treeGen = new WorldGenSpruceTreePerverted(false);
} else if (rand.nextInt(3) == 0) {
treeGen = new WorldGenBirchTreePerverted(false, false);
} else {
treeGen = new WorldGenTreesPerverted(false, 3, BlockPlanks.EnumType.OAK, true);
}
}
if (treeGen != null) {
for (int i = 0; i < 80; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight);
z = rand.nextInt(16) + 8;
BlockPos pos = blockPos.add(x, y, z);
if (treeGen.generate(world, rand, pos)) {
treeGen.generateSaplings(world, rand, pos);
}
}
for (int i = 0; i < 60; ++i) {
x = rand.nextInt(16) + 8;
y = 8 + rand.nextInt(5);
z = rand.nextInt(16) + 8;
BlockPos pos = blockPos.add(x, y, z);
if (treeGen.generate(world, rand, pos)) {
treeGen.generateSaplings(world, rand, pos);
}
}
}
}
if (decorator.generateFalls) {
if (BiomeDictionary.hasType(biome, Type.WATER)) {
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.LAKE_WATER)) {
for (int i = 0; i < 150; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10);
z = rand.nextInt(16) + 8;
liquidWaterGen.generate(world, rand, blockPos.add(x, y, z));
}
}
} else {
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.LAKE_WATER)) {
for (int i = 0; i < 100; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(rand.nextInt(worldHeight - 16) + 10);
z = rand.nextInt(16) + 8;
liquidWaterGen.generate(world, rand, blockPos.add(x, y, z));
}
}
if (TerrainGen.decorate(world, rand, blockPos, Decorate.EventType.LAKE_LAVA)) {
for (int i = 0; i < 20; ++i) {
x = rand.nextInt(16) + 8;
y = rand.nextInt(worldHeight / 2);
z = rand.nextInt(16) + 8;
liquidLavaGen.generate(world, rand, blockPos.add(x, y, z));
}
}
}
}
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(world, rand, blockPos));
ForgeEventFactory.onChunkPopulate(false, this, world, rand, chunkX, chunkZ, false);
BlockFalling.fallInstantly = false;
}
use of cavern.world.gen.WorldGenTreesPerverted in project Cavern2 by kegare.
the class BlockSaplingPerverted method generateTree.
@Override
public void generateTree(World world, BlockPos pos, IBlockState state, Random rand) {
if (!TerrainGen.saplingGrowTree(world, rand, pos)) {
return;
}
WorldGenerator treeGen;
switch(state.getValue(TYPE)) {
case SPRUCE:
treeGen = new WorldGenSpruceTreePerverted(true);
break;
case BIRCH:
treeGen = new WorldGenBirchTreePerverted(true, false);
break;
case JUNGLE:
treeGen = new WorldGenTreesPerverted(true, 3 + rand.nextInt(6), BlockPlanks.EnumType.JUNGLE, false);
break;
default:
treeGen = new WorldGenTreesPerverted(true, 3, BlockPlanks.EnumType.OAK, false);
break;
}
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 4);
if (!treeGen.generate(world, rand, pos)) {
world.setBlockState(pos, state, 4);
}
}
Aggregations