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,13 +71,9 @@ public class DefaultFarmerBehavior implements IFarmerBehavior{
}
private static boolean tryPlant(IBlockState toPlant, World world, BlockPos pos){
BlockBush plantBlock = (BlockBush)toPlant.getBlock();
if(plantBlock.canPlaceBlockAt(world, pos) && plantBlock.canBlockStay(world, 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;
}
if(toPlant.getBlock().canPlaceBlockAt(world, pos)){
world.setBlockState(pos, toPlant);
return true;
}
return false;
}