use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project MorePlanets by SteveKunG.
the class BiomeDecoratorNibiru method generate.
@Override
protected void generate(Biome biome, World world, Random rand) {
int i;
for (i = 0; i < this.infectedTallGrassPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_TALL_GRASS.getDefaultState().withProperty(BlockNibiruTallGrass.VARIANT, BlockNibiruTallGrass.BlockType.INFECTED_TALL_GRASS)), world, rand, this.chunkPos);
}
for (i = 0; i < this.pureHurbPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.PURE_HURB)), world, rand, this.chunkPos);
}
for (i = 0; i < this.terrapuffHurbPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.TERRAPUFF_HURB)), world, rand, this.chunkPos);
}
for (i = 0; i < this.batasiaDandelionPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.BATASIA_DANDELION)), world, rand, this.chunkPos);
}
for (i = 0; i < this.pyoloniaPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.PYOLONIA_FLOWER)), world, rand, this.chunkPos);
}
for (i = 0; i < this.philipyPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.PHILIPY_FLOWER)), world, rand, this.chunkPos);
}
for (i = 0; i < this.whiteTailPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.WHITE_TAIL)), world, rand, this.chunkPos);
}
for (i = 0; i < this.vealiumVinePerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_FLOWER.getDefaultState().withProperty(BlockNibiruFlower.VARIANT, BlockNibiruFlower.BlockType.VEALIUM_VINE_FLOWER)), world, rand, this.chunkPos);
}
for (i = 0; i < this.seaweedPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenNibiruSeaweed(NibiruBlocks.NIBIRU_SEAWEED.getDefaultState().withProperty(BlockNibiruSeaweed.VARIANT, BlockNibiruSeaweed.BlockType.NIBIRU_SEAWEED)), world, rand, this.chunkPos);
}
for (i = 0; i < this.infectedCactusPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenInfectedCactus(), world, rand, this.chunkPos);
}
for (i = 0; i < this.deadBushPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenDeadBush(), world, rand, this.chunkPos);
}
for (i = 0; i < this.infectedFernPerChunk; ++i) {
DecorateHelper.generatePlants(biome.getRandomWorldGenForGrass(rand), world, rand, this.chunkPos);
}
for (i = 0; i < this.greenVeinTallGrassPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenFlowersMP(NibiruBlocks.NIBIRU_TALL_GRASS.getDefaultState().withProperty(BlockNibiruTallGrass.VARIANT, BlockNibiruTallGrass.BlockType.GREEN_VEIN_TALL_GRASS)), world, rand, this.chunkPos);
}
for (i = 0; i < this.waterlilyPerChunk; ++i) {
int x = rand.nextInt(16) + 8;
int z = rand.nextInt(16) + 8;
int y = world.getHeight(this.chunkPos.add(x, 0, z)).getY() * 2;
if (y > 0) {
int y1 = rand.nextInt(y);
BlockPos blockpos4;
BlockPos blockpos7;
for (blockpos4 = this.chunkPos.add(x, y1, z); blockpos4.getY() > 0; blockpos4 = blockpos7) {
blockpos7 = blockpos4.down();
if (!world.isAirBlock(blockpos7)) {
break;
}
}
new WorldGenSporelily().generate(world, rand, blockpos4);
}
}
for (i = 0; i < this.clayPerChunk; ++i) {
int l1 = rand.nextInt(16) + 8;
int i6 = rand.nextInt(16) + 8;
new WorldGenNibiruClay(4).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(l1, 0, i6)));
}
for (i = 0; i < this.reedsPerChunk; ++i) {
DecorateHelper.generatePlants(new WorldGenInfectedSugarCane(), world, rand, this.chunkPos);
}
for (i = 0; i < this.sandPatchesPerChunk; ++i) {
int j = rand.nextInt(16) + 8;
int k = rand.nextInt(16) + 8;
new WorldGenNibiruSand(NibiruBlocks.INFECTED_SAND.getDefaultState(), 7).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(j, 0, k)));
}
for (i = 0; i < this.gravelPatchesPerChunk; ++i) {
int i2 = rand.nextInt(16) + 8;
int j6 = rand.nextInt(16) + 8;
new WorldGenNibiruSand(NibiruBlocks.INFECTED_GRAVEL.getDefaultState(), 6).generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(i2, 0, j6)));
}
int treesPerChunk = this.infectedTreesPerChunk;
if (rand.nextInt(10) == 0) {
++treesPerChunk;
}
for (i = 0; i < treesPerChunk; ++i) {
int k6 = rand.nextInt(16) + 8;
int l = rand.nextInt(16) + 8;
BlockPos blockpos = world.getHeight(this.chunkPos.add(k6, 0, l));
WorldGenAbstractTree worldgenabstracttree = biome.getRandomTreeFeature(rand);
if (worldgenabstracttree.generate(world, rand, blockpos)) {
worldgenabstracttree.generateSaplings(world, rand, blockpos);
}
}
if (rand.nextInt(1000) == 0) {
int x = rand.nextInt(16) + 8;
int z = rand.nextInt(16) + 8;
new WorldGenCrystalObelisk().generate(world, rand, world.getTopSolidOrLiquidBlock(this.chunkPos.add(x, 0, z)));
}
if (this.orangeBushPerChunk > 0) {
int roseBushPerChunk = rand.nextInt(5) - this.orangeBushPerChunk;
for (i = 0; i < roseBushPerChunk; ++i) {
for (int i2 = 0; i2 < 5; ++i2) {
int y = rand.nextInt(world.getHeight(this.chunkPos.add(rand.nextInt(16) + 8, 0, rand.nextInt(16) + 8)).getY() + 32);
if (new WorldGenNibiruDoublePlant(BlockNibiruDoublePlant.BlockType.INFECTED_ORANGE_ROSE_BUSH).generate(world, rand, new BlockPos(this.chunkPos.getX() + rand.nextInt(16) + 8, y, this.chunkPos.getZ() + rand.nextInt(16) + 8))) {
break;
}
}
}
}
for (i = 0; i < 4; i++) {
new WorldGenMultalicCrystal().generate(world, rand, this.chunkPos.add(rand.nextInt(16) + 8, rand.nextInt(36), rand.nextInt(16) + 8));
}
}
use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project MorePlanets by SteveKunG.
the class BiomeInfectedDeadRoofedForest method decorate.
@Override
public void decorate(World world, Random rand, BlockPos pos) {
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
int k = i * 4 + 1 + 8 + rand.nextInt(3);
int l = j * 4 + 1 + 8 + rand.nextInt(3);
BlockPos blockpos = world.getHeight(pos.add(k, 0, l));
WorldGenAbstractTree worldgenabstracttree = this.getRandomTreeFeature(rand);
if (worldgenabstracttree.generate(world, rand, blockpos)) {
worldgenabstracttree.generateSaplings(world, rand, blockpos);
}
}
}
if (rand.nextInt(25) == 0) {
new WorldGenInfectedVinesDirt().generate(world, rand, DecorateHelper.getSimplePos(world, pos, rand));
}
super.decorate(world, rand, pos);
}
use of net.minecraft.world.gen.feature.WorldGenAbstractTree 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 net.minecraft.world.gen.feature.WorldGenAbstractTree in project takumicraft by TNTModders.
the class EntityTreeCreeper method takumiExplode.
@Override
public void takumiExplode() {
if (!this.world.isRemote) {
this.world.createExplosion(this, this.posX, this.posY, this.posZ, this.getPowered() ? 6 : 3, false);
WorldGenAbstractTree tree = this.getPowered() ? new TakumiWorldGenBigTree(true, TakumiBlockCore.CREEPER_LOG.getDefaultState(), TakumiBlockCore.CREEPER_LEAVES.getDefaultState()) : new TakumiWorldGenTrees(true, false, TakumiBlockCore.CREEPER_LOG.getDefaultState(), TakumiBlockCore.CREEPER_LEAVES.getDefaultState());
tree.generate(this.world, this.rand, new BlockPos(this));
Calendar calendar = this.world.getCurrentDate();
int month = calendar.get(Calendar.MONTH) + 1;
int date = calendar.get(Calendar.DATE);
if (month == 12 && (date == 24 || date == 25)) {
for (int i = 0; i < 45; i++) {
BlockPos pos = this.getPosition().add(this.rand.nextInt(40) - 20, 0, this.rand.nextInt(40) - 20);
pos = pos.up(this.world.getHeight(pos).getY() - pos.getY());
EntityFireworksCreeper.createTree(this, pos);
}
}
}
}
use of net.minecraft.world.gen.feature.WorldGenAbstractTree in project RecurrentComplex by Ivorforce.
the class VanillaDecorationAdapter method generate.
@Override
public void generate(WorldServer worldIn, Random random, Biome biomeIn, BiomeDecorator decorator, BlockPos chunkPos, RCBiomeDecorator.DecorationType type) {
RCWorldgenMonitor.start("simulating vanilla decoration");
try {
switch(type) {
case TREE:
{
int k6 = random.nextInt(16) + 8;
int l = random.nextInt(16) + 8;
WorldGenAbstractTree worldgenabstracttree = biomeIn.getRandomTreeFeature(random);
worldgenabstracttree.setDecorationDefaults();
BlockPos blockpos = worldIn.getHeight(chunkPos.add(k6, 0, l));
if (worldgenabstracttree.generate(worldIn, random, blockpos))
worldgenabstracttree.generateSaplings(worldIn, random, blockpos);
break;
}
case BIG_SHROOM:
{
int l6 = random.nextInt(16) + 8;
int k10 = random.nextInt(16) + 8;
decorator.bigMushroomGen.generate(worldIn, random, worldIn.getHeight(chunkPos.add(l6, 0, k10)));
break;
}
case CACTUS:
{
int l9 = random.nextInt(16) + 8;
int k13 = random.nextInt(16) + 8;
int l16 = worldIn.getHeight(chunkPos.add(l9, 0, k13)).getY() * 2;
if (l16 > 0) {
int j19 = random.nextInt(l16);
decorator.cactusGen.generate(worldIn, random, chunkPos.add(l9, j19, k13));
}
break;
}
case DESERT_WELL:
{
int i = random.nextInt(16) + 8;
int j = random.nextInt(16) + 8;
BlockPos blockpos = worldIn.getHeight(chunkPos.add(i, 0, j)).up();
(new WorldGenDesertWells()).generate(worldIn, random, blockpos);
break;
}
case FOSSIL:
{
(new WorldGenFossils()).generate(worldIn, random, chunkPos);
break;
}
default:
throw new IllegalArgumentException("Unrecognized type: " + type.toString());
}
} catch (Exception e) {
RecurrentComplex.logger.error("Error trying to emulate vanilla decoration", e);
}
RCWorldgenMonitor.stop();
}
Aggregations