Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
- {
- float f = 1.0F;
- BlockPos blockpos = pos.down();
- for (int i = -1; i <= 1; ++i)
- {
- for (int j = -1; j <= 1; ++j)
- {
- float f1 = 0.0F;
- IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));
- if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn))
- {
- f1 = 1.0F;
- if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j)))
- {
- f1 = 3.0F;
- }
- }
- if (i != 0 || j != 0)
- {
- f1 /= 4.0F;
- }
- f += f1;
- }
- }
- BlockPos blockpos1 = pos.north();
- BlockPos blockpos2 = pos.south();
- BlockPos blockpos3 = pos.west();
- BlockPos blockpos4 = pos.east();
- boolean flag = blockIn == worldIn.getBlockState(blockpos3).getBlock() || blockIn == worldIn.getBlockState(blockpos4).getBlock();
- boolean flag1 = blockIn == worldIn.getBlockState(blockpos1).getBlock() || blockIn == worldIn.getBlockState(blockpos2).getBlock();
- if (flag && flag1)
- {
- f /= 2.0F;
- }
- else
- {
- boolean flag2 = blockIn == worldIn.getBlockState(blockpos3.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos3.south()).getBlock();
- if (flag2)
- {
- f /= 2.0F;
- }
- }
- return f;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement