use of net.tropicraft.core.common.worldgen.WorldGenFruitTrees in project Tropicraft by Tropicraft.
the class BiomeDecoratorTropics method genDecorations.
@Override
public void genDecorations(Biome biome, World world, Random rand) {
super.genDecorations(biome, world, rand);
int i = 0;
int k = 0;
if (BiomeTropicraft.DISABLEDECORATION) {
System.out.println("decoration disabled via BiomeGenTropics.DISABLEDECORATION, " + this);
return;
}
if (GenRates.BAMBOO_CHANCE != 0 && rand.nextInt(GenRates.BAMBOO_CHANCE) == 0) {
i = chunkPos.getX();
k = chunkPos.getZ();
new WorldGenBamboo(world, rand).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
if (GenRates.NORMAL_PALM_CHANCE != 0 && rand.nextInt(GenRates.NORMAL_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenNormalPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.CURVED_PALM_CHANCE != 0 && rand.nextInt(GenRates.CURVED_PALM_CHANCE) == 0) {
i = chunkPos.getX() + 13 + rand.nextInt(5);
k = chunkPos.getZ() + 13 + rand.nextInt(5);
new WorldGenCurvedPalms(world, rand).generate(new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.EIH_CHANCE != 0 && rand.nextInt(GenRates.EIH_CHANCE) == 0) {
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenEIH(world, rand).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenTropicalFlowers(world, rand, BlockRegistry.flowers).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
if (GenRates.LARGE_PALM_CHANCE != 0 && rand.nextInt(GenRates.LARGE_PALM_CHANCE) == 0) {
// Center in chunk to avoid CCG
i = chunkPos.getX() + 16;
k = chunkPos.getZ() + 16;
new WorldGenLargePalmTrees(world, rand).generate(world, rand, new BlockPos(i, this.getTerrainHeightAt(world, i, k), k));
}
if (GenRates.FRUIT_TREE_CHANCE != 0 && rand.nextInt(GenRates.FRUIT_TREE_CHANCE) == 0) {
int treeType = new Random((long) (chunkPos.getX() >> 2) << 32 | (long) (chunkPos.getZ() >> 2)).nextInt(4);
i = randDecorationCoord(rand, chunkPos.getX(), 16);
k = randDecorationCoord(rand, chunkPos.getZ(), 16);
new WorldGenFruitTrees(world, rand, treeType).generate(new BlockPos(i, getTerrainHeightAt(world, i, k), k));
}
if (GenRates.TALL_GRASS_CHANCE != 0 && rand.nextInt(GenRates.TALL_GRASS_CHANCE) == 0) {
for (int a = 0; a < 10; a++) {
int xRand = rand.nextInt(16) + 8;
int zRand = rand.nextInt(16) + 8;
int yRand = world.getHeight(this.chunkPos.add(xRand, 0, zRand)).getY() * 2;
if (yRand > 0) {
int rando = rand.nextInt(yRand);
biome.getRandomWorldGenForGrass(rand).generate(world, rand, this.chunkPos.add(xRand, rando, zRand));
}
}
}
// Pineapples
if (GenRates.TALL_FLOWERS_CHANCE != 0 && rand.nextInt(GenRates.TALL_FLOWERS_CHANCE) == 0) {
i = chunkPos.getX();
int y = getTerrainHeightAt(world, i, k);
k = chunkPos.getZ();
BlockPos pos = new BlockPos(i, y, k);
(new WorldGenTallFlower(world, rand, BlockRegistry.pineapple.getDefaultState())).generate(pos);
}
// Irises
if (GenRates.TALL_FLOWERS_CHANCE != 0 && rand.nextInt(GenRates.TALL_FLOWERS_CHANCE) == 0) {
i = chunkPos.getX();
int y = getTerrainHeightAt(world, i, k);
k = chunkPos.getZ();
BlockPos pos = new BlockPos(i, y, k);
(new WorldGenTallFlower(world, rand, BlockRegistry.iris.getDefaultState())).generate(pos);
}
// Vanilla Logic
for (int k4 = 0; k4 < reedsPerChunk; ++k4) {
int i9 = rand.nextInt(16) + 8;
int l12 = rand.nextInt(16) + 8;
int i16 = world.getHeight(this.chunkPos.add(i9, 0, l12)).getY() * 2;
if (i16 > 0) {
int l18 = rand.nextInt(i16);
this.reedGen.generate(world, rand, this.chunkPos.add(i9, l18, l12));
}
}
BiomeDecoratorTropicsBeach.decorateForVillage(world, rand, chunkPos);
//
// for(int a = 0; a < ConfigGenRates.WATERFALL_AMOUNT; a++) {
// new WorldGenWaterfall(world, rand).generate(randDecorationCoord(rand, x, 16), WorldProviderTropicraft.MID_HEIGHT + rand.nextInt(WorldProviderTropicraft.INTER_HEIGHT), randDecorationCoord(rand, z, 16));
// }
}
use of net.tropicraft.core.common.worldgen.WorldGenFruitTrees in project Tropicraft by Tropicraft.
the class BlockTropicsSapling method grow.
@Override
public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) {
// Change flag (and back) to make it show up when generated
TCGenBase.blockGenNotifyFlag = 3;
WorldGenerator gen;
TropicraftSaplings variant;
switch(variant = state.getValue(VARIANT)) {
case PALM:
int b = rand.nextInt(3);
if (b == 0) {
gen = new WorldGenLargePalmTrees(worldIn, rand);
} else if (b == 1) {
gen = new WorldGenCurvedPalms(worldIn, rand);
} else if (b == 2) {
gen = new WorldGenNormalPalms(worldIn, rand);
} else {
gen = null;
}
break;
case MAHOGANY:
gen = randomRainforestTreeGen(worldIn);
break;
default:
gen = new WorldGenFruitTrees(worldIn, rand, variant.getMeta() - 2);
break;
}
if (gen != null) {
worldIn.setBlockToAir(pos);
if (!gen.generate(worldIn, rand, pos)) {
worldIn.setBlockState(pos, state.withProperty(BlockTropicsSapling.VARIANT, variant), 3);
}
}
TCGenBase.blockGenNotifyFlag = TCGenBase.BLOCK_GEN_NOTIFY_FLAG_DEFAULT;
}
Aggregations