From 5d88e43a7e3ea934de7fdda131d32ea865a748ec Mon Sep 17 00:00:00 2001 From: Charles Howard Date: Sat, 31 Dec 2016 08:47:27 -0500 Subject: [PATCH] Missing crosshair change if Mob is in Range #18 - also added some possible speed enhancements --- java/net/torocraft/torohealthmod/events/Events.java | 4 ++++ .../torohealthmod/gui/GuiEntityStatus.java | 13 +++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/java/net/torocraft/torohealthmod/events/Events.java b/java/net/torocraft/torohealthmod/events/Events.java index 33457ac..25153e9 100644 --- a/java/net/torocraft/torohealthmod/events/Events.java +++ b/java/net/torocraft/torohealthmod/events/Events.java @@ -1,6 +1,7 @@ package net.torocraft.torohealthmod.events; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.torocraft.torohealthmod.ToroHealthMod; @@ -14,6 +15,9 @@ public void displayDamage(LivingUpdateEvent event) { @SubscribeEvent public void displayEntityStatus(RenderGameOverlayEvent.Pre event) { + if (event.getType() != ElementType.CHAT) { + return; + } ToroHealthMod.proxy.setEntityInCrosshairs(); } diff --git a/java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java b/java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java index fb2807e..2614c99 100644 --- a/java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java +++ b/java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java @@ -72,20 +72,21 @@ public void setEntity(EntityLivingBase entityToTrack) { } @SubscribeEvent - public void drawHealthBar(RenderGameOverlayEvent event) { + public void drawHealthBar(RenderGameOverlayEvent.Pre event) { if (!showHealthBar) { return; } + + if (event.getType() != ElementType.CHAT) { + return; + } + String entityStatusDisplay = ConfigurationHandler.entityStatusDisplay; - age++; + age = age + 15; if (age > ConfigurationHandler.hideDelay || entityStatusDisplay.equals("OFF")) { hideHealthBar(); } - if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { - return; - } - boolean showEntityModel = ConfigurationHandler.showEntityModel; if (showEntityModel) { entityRenderWidth = 40;