Skip to content

Commit

Permalink
Missing crosshair change if Mob is in Range #18
Browse files Browse the repository at this point in the history
- also added some possible speed enhancements
  • Loading branch information
Charles Howard committed Dec 31, 2016
1 parent 13821eb commit 5d88e43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions java/net/torocraft/torohealthmod/events/Events.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}

Expand Down
13 changes: 7 additions & 6 deletions java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5d88e43

Please sign in to comment.