From f57de19b06dea582d74cff60a218d48c89feedf0 Mon Sep 17 00:00:00 2001 From: mezz Date: Sun, 2 Oct 2016 15:17:32 -0700 Subject: [PATCH] Fix #1442 Let BeeHousings detect biome changes --- src/main/java/forestry/apiculture/genetics/Bee.java | 3 +-- .../forestry/apiculture/multiblock/AlvearyController.java | 8 ++------ .../forestry/apiculture/tiles/TileBeeHousingBase.java | 6 +----- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/forestry/apiculture/genetics/Bee.java b/src/main/java/forestry/apiculture/genetics/Bee.java index 58a9f014f..b411efe37 100644 --- a/src/main/java/forestry/apiculture/genetics/Bee.java +++ b/src/main/java/forestry/apiculture/genetics/Bee.java @@ -248,7 +248,6 @@ public class Bee extends IndividualLiving implements IBee { @Override public Set getCanWork(IBeeHousing housing) { World world = housing.getWorldObj(); - Biome biome = housing.getBiome(); BlockPos housingCoords = housing.getCoordinates(); Set errorStates = new HashSet<>(); @@ -282,7 +281,7 @@ public class Bee extends IndividualLiving implements IBee { } // / Check for the sky, except if in hell - if (biome != null && !BiomeHelper.isBiomeHellish(biome)) { + if (!world.provider.getHasNoSky()) { if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) { errorStates.add(EnumErrorCode.NO_SKY); } diff --git a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java index 60c7aac02..c6f39c280 100644 --- a/src/main/java/forestry/apiculture/multiblock/AlvearyController.java +++ b/src/main/java/forestry/apiculture/multiblock/AlvearyController.java @@ -54,7 +54,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple private final InventoryBeeHousing inventory; private final IBeekeepingLogic beekeepingLogic; - private Biome cachedBiome; private float tempChange = 0.0f; private float humidChange = 0.0f; @@ -381,11 +380,8 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple @Override public Biome getBiome() { - if (cachedBiome == null) { - BlockPos coords = getReferenceCoord(); - cachedBiome = worldObj.getBiome(coords); - } - return cachedBiome; + BlockPos coords = getReferenceCoord(); + return worldObj.getBiome(coords); } @Override diff --git a/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java b/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java index ef9c730d0..f73ff7c91 100644 --- a/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java +++ b/src/main/java/forestry/apiculture/tiles/TileBeeHousingBase.java @@ -38,7 +38,6 @@ import net.minecraft.world.biome.Biome; public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IOwnedTile, IClimatised, IGuiBeeHousingInventory, IStreamableGui { private final OwnerHandler ownerHandler = new OwnerHandler(); private final IBeekeepingLogic beeLogic; - private Biome cachedBiome; // CLIENT private int breedingProgressPercent = 0; @@ -164,10 +163,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing // / IBEEHOUSING @Override public Biome getBiome() { - if (cachedBiome == null) { - cachedBiome = worldObj.getBiome(getPos()); - } - return cachedBiome; + return worldObj.getBiome(getPos()); } @Override