Don't cast every IPlantable to BlockBush

This commit is contained in:
Shadows_of_Fire 2018-01-31 00:07:38 -05:00
parent f5ae3240f8
commit bfe876f423

View file

@ -71,14 +71,10 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
} }
private static boolean tryPlant(IBlockState toPlant, World world, BlockPos pos){ private static boolean tryPlant(IBlockState toPlant, World world, BlockPos pos){
BlockBush plantBlock = (BlockBush)toPlant.getBlock(); if(toPlant.getBlock().canPlaceBlockAt(world, pos)){
if(plantBlock.canPlaceBlockAt(world, pos) && plantBlock.canBlockStay(world, pos, toPlant)){ world.setBlockState(pos, toPlant);
//This fixes a bug with Beetroot being able to be planted anywhere because Minecraft sucks
if(plantBlock != Blocks.BEETROOTS || Blocks.WHEAT.canPlaceBlockAt(world, pos)){
world.setBlockState(pos, toPlant, 3);
return true; return true;
} }
}
return false; return false;
} }