use of net.tropicraft.core.common.enums.TropicraftSaplings 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