diff --git a/src/main/java/forestry/core/TickHandlerCoreClient.java b/src/main/java/forestry/core/TickHandlerCoreClient.java index 85975eef1..723648008 100755 --- a/src/main/java/forestry/core/TickHandlerCoreClient.java +++ b/src/main/java/forestry/core/TickHandlerCoreClient.java @@ -10,12 +10,8 @@ ******************************************************************************/ package forestry.core; -import java.util.concurrent.ConcurrentLinkedQueue; - import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatComponentText; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent; @@ -25,16 +21,7 @@ import forestry.core.utils.GeneticsUtil; public class TickHandlerCoreClient { - private static final ConcurrentLinkedQueue messages = new ConcurrentLinkedQueue(); - private boolean hasNaturalistView; - - public TickHandlerCoreClient() { - FMLCommonHandler.instance().bus().register(this); - } - - public void queueChatMessage(String message) { - messages.add(message); - } + private boolean hasNaturalistEye; @SubscribeEvent public void onPlayerTick(PlayerTickEvent event) { @@ -42,20 +29,13 @@ public class TickHandlerCoreClient { return; } - EntityPlayer player = Proxies.common.getClientInstance().thePlayer; + EntityPlayer player = event.player; boolean hasNaturalistEye = GeneticsUtil.hasNaturalistEye(player); - if (hasNaturalistEye != hasNaturalistView) { - hasNaturalistView = !hasNaturalistView; + if (this.hasNaturalistEye != hasNaturalistEye) { + this.hasNaturalistEye = hasNaturalistEye; Proxies.common.getClientInstance().renderGlobal.markBlockRangeForRenderUpdate( (int) player.posX - 32, (int) player.posY - 32, (int) player.posZ - 32, (int) player.posX + 32, (int) player.posY + 32, (int) player.posZ + 32); } - - if (messages.size() > 0) { - String message; - while ((message = messages.poll()) != null) { - player.addChatMessage(new ChatComponentText(message)); - } - } } } diff --git a/src/main/java/forestry/core/TickHandlerCoreServer.java b/src/main/java/forestry/core/TickHandlerCoreServer.java index 553bea929..fc8092710 100755 --- a/src/main/java/forestry/core/TickHandlerCoreServer.java +++ b/src/main/java/forestry/core/TickHandlerCoreServer.java @@ -19,10 +19,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.ChunkDataEvent; -import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; @@ -40,8 +38,6 @@ public class TickHandlerCoreServer { public TickHandlerCoreServer(WorldGenerator worldGenerator) { this.worldGenerator = worldGenerator; - FMLCommonHandler.instance().bus().register(this); - MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent diff --git a/src/main/java/forestry/core/proxy/ClientProxyCommon.java b/src/main/java/forestry/core/proxy/ClientProxyCommon.java index 4fa83e7a5..dc4289114 100755 --- a/src/main/java/forestry/core/proxy/ClientProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ClientProxyCommon.java @@ -27,6 +27,8 @@ import net.minecraft.world.World; import com.mojang.authlib.GameProfile; +import cpw.mods.fml.common.FMLCommonHandler; + import org.lwjgl.input.Keyboard; import forestry.apiculture.render.TextureHabitatLocator; @@ -52,7 +54,7 @@ public class ClientProxyCommon extends ProxyCommon { public void registerTickHandlers(WorldGenerator worldGenerator) { super.registerTickHandlers(worldGenerator); - new TickHandlerCoreClient(); + FMLCommonHandler.instance().bus().register(new TickHandlerCoreClient()); } @Override diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index 88970dd9a..b25b3fcee 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -32,6 +32,7 @@ import net.minecraft.world.WorldServer; import com.mojang.authlib.GameProfile; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; @@ -67,7 +68,9 @@ public class ProxyCommon { } public void registerTickHandlers(WorldGenerator worldGenerator) { - new TickHandlerCoreServer(worldGenerator); + TickHandlerCoreServer tickHandlerCoreServer = new TickHandlerCoreServer(worldGenerator); + FMLCommonHandler.instance().bus().register(tickHandlerCoreServer); + MinecraftForge.EVENT_BUS.register(tickHandlerCoreServer); } public void registerBlock(Block block, Class itemClass) {