From ef0dc7b7f73c7475bb05b801d6122d880e29cd75 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 17 Sep 2015 04:14:36 -0700 Subject: [PATCH] Fix #833 Spread out HasFlowersCache hasFlowers checking over ticks --- src/main/java/forestry/apiculture/HasFlowersCache.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/forestry/apiculture/HasFlowersCache.java b/src/main/java/forestry/apiculture/HasFlowersCache.java index b77846a27..47ca8d73b 100644 --- a/src/main/java/forestry/apiculture/HasFlowersCache.java +++ b/src/main/java/forestry/apiculture/HasFlowersCache.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.apiculture; +import java.util.Random; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; @@ -23,7 +25,10 @@ import forestry.plugins.PluginApiculture; public class HasFlowersCache implements INBTTagable { private static final String nbtKey = "hasFlowerCache"; + private static final Random random = new Random(); + private static final int flowerCheckInterval = 128; + private final int flowerCheckTime = random.nextInt(flowerCheckInterval); private ChunkCoordinates flowerCoords = null; private int cooldown = 0; @@ -33,7 +38,7 @@ public class HasFlowersCache implements INBTTagable { World world = beeHousing.getWorld(); if (flowerCoords != null) { - if (world.getTotalWorldTime() % 100 != 0) { + if (world.getTotalWorldTime() % flowerCheckInterval != flowerCheckTime) { return true; }