diff --git a/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java b/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java index 4828cf302..13d481008 100644 --- a/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java +++ b/src/main/java/forestry/apiculture/flowers/FlowerRegistry.java @@ -213,6 +213,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe private static boolean isAcceptedFlower(String flowerType, Set acceptedBlocks, Set acceptedFlowers, World world, int x, int y, int z) { + if (!world.blockExists(x, y, z)) return false; Block block = world.getBlock(x, y, z); final int meta; diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java index 67f62d771..fd90942da 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleDirtGrass.java @@ -24,7 +24,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule { @Override public boolean growFlower(IFlowerRegistry flowerRegistry, String flowerType, World world, IIndividual individual, int x, int y, int z) { - if (!world.isAirBlock(x, y, z)) { + if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) { return false; } @@ -39,7 +39,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule { @Override public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) { - if (!world.isAirBlock(x, y, z)) { + if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) { return false; } diff --git a/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java b/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java index 09aadb05f..9193a167e 100644 --- a/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java +++ b/src/main/java/forestry/apiculture/flowers/GrowthRuleFlowerPot.java @@ -34,6 +34,10 @@ public class GrowthRuleFlowerPot implements IFlowerGrowthRule { } private static boolean growFlower(String flowerType, World world, int x, int y, int z) { + if (!world.blockExists(x, y, z)) { + return false; + } + TileEntity tile = world.getTileEntity(x, y, z); if (!(tile instanceof TileEntityFlowerPot)) { return false; diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index fea1ff5be..1a23b9141 100644 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -773,6 +773,9 @@ public class Bee extends IndividualLiving implements IBee { for (int i = 0; i < 20; i++) { Vect randomPos = Vect.getRandomPositionInArea(random, area); Vect blockPos = Vect.add(housingPos, randomPos, offset); + if (!world.blockExists(blockPos.x, blockPos.y, blockPos.z)) { + continue; + } TileEntity tile = world.getTileEntity(blockPos.x, blockPos.y, blockPos.z); if (tile instanceof IPollinatable) { diff --git a/src/main/java/forestry/core/utils/GeneticsUtil.java b/src/main/java/forestry/core/utils/GeneticsUtil.java index a5a546189..404c1d2ee 100644 --- a/src/main/java/forestry/core/utils/GeneticsUtil.java +++ b/src/main/java/forestry/core/utils/GeneticsUtil.java @@ -96,6 +96,8 @@ public class GeneticsUtil { * altering the world by changing vanilla leaves to forestry ones. */ public static ICheckPollinatable getCheckPollinatable(World world, final int x, final int y, final int z) { + if (!world.blockExists(x, y, z)) return null; + TileEntity tile = world.getTileEntity(x, y, z); if (tile instanceof IPollinatable) {