Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Howard committed Dec 6, 2016
2 parents b15efa4 + 1ea4311 commit d35fbeb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
5 changes: 3 additions & 2 deletions java/net/torocraft/torohealthmod/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.nbt.NBTTagInt;
Expand Down Expand Up @@ -85,8 +86,8 @@ private void displayParticle(Entity entity, int damage) {
public void setEntityInCrosshairs() {
RayTraceResult r = getMouseOver(1.0f);
if (r != null && RayTraceResult.Type.ENTITY.equals(r.typeOfHit)) {
if (r.entityHit instanceof EntityLivingBase) {
entityStatusGUI.setEntity((EntityLivingBase) r.entityHit);
if (r.entityHit instanceof EntityLiving) {
entityStatusGUI.setEntity((EntityLiving) r.entityHit);
}
}
}
Expand Down
23 changes: 17 additions & 6 deletions java/net/torocraft/torohealthmod/gui/GuiEntityStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
Expand All @@ -21,7 +22,7 @@
public class GuiEntityStatus extends Gui {

private Minecraft mc;
private EntityLivingBase entity;
private EntityLiving entity;
private int age = 0;
private boolean showHealthBar = false;

Expand All @@ -39,6 +40,7 @@ public class GuiEntityStatus extends Gui {
private int entityRenderWidth;
private final int entityRenderHeightUnit = 20;
private final int entityRenderX = 20;
private Entity leashedToEntity;

/*
* for hearts drawing
Expand All @@ -59,7 +61,7 @@ public GuiEntityStatus(Minecraft mc) {
this.mc = mc;
}

public void setEntity(EntityLivingBase entityToTrack) {
public void setEntity(EntityLiving entityToTrack) {
showHealthBar();
age = 0;
if (entity != null && entity.getUniqueID().equals(entityToTrack.getUniqueID())) {
Expand Down Expand Up @@ -143,9 +145,14 @@ public void drawEntityOnScreen() {
screenX = ConfigurationHandler.statusDisplayX + (entityRenderWidth / 2);
screenY = ConfigurationHandler.statusDisplayY + entityRenderHeight + 10;
}

int scale = MathHelper.ceiling_double_int(h);

if (entity.getLeashed()) {
leashedToEntity = entity.getLeashedToEntity();
entity.setLeashedToEntity(null, false);
}

float prevYawOffset = entity.renderYawOffset;
float prevYaw = entity.rotationYaw;
float prevPitch = entity.rotationPitch;
Expand Down Expand Up @@ -182,6 +189,11 @@ public void drawEntityOnScreen() {
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

if (leashedToEntity != null) {
entity.setLeashedToEntity(leashedToEntity, false);
leashedToEntity = null;
}
}

private boolean isUnsupportedDisplayType(String entityStatusDisplay) {
Expand Down Expand Up @@ -235,7 +247,6 @@ private void drawName() {
screenY += 10;
}


private int drawHearts() {
mc.renderEngine.bindTexture(ICONS);
int currentHealth = MathHelper.ceiling_float_int(entity.getHealth());
Expand Down Expand Up @@ -326,7 +337,7 @@ private void adjustForDisplayPositionSetting() {
screenY = ConfigurationHandler.statusDisplayY;
return;
}

if (displayPosition.contains("TOP")) {
screenY = PADDING_FROM_EDGE;
}
Expand Down

0 comments on commit d35fbeb

Please sign in to comment.