Skip to content

Commit

Permalink
https://github.com/ToroCraft/ToroHealth/issues/25
Browse files Browse the repository at this point in the history
  • Loading branch information
frodare committed Mar 8, 2017
1 parent 15c8015 commit 73a4c76
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.11.2-10"
version = "1.11.2-11"
group= "net.torocraft.torohealth"
archivesBaseName = "torohealth"

Expand Down
2 changes: 1 addition & 1 deletion java/net/torocraft/torohealthmod/ToroHealthMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ToroHealthMod {

public static final String MODID = "torohealthmod";
public static final String VERSION = "1.11.2-10";
public static final String VERSION = "1.11.2-11";
public static final String MODNAME = "ToroHealthMod";

@SidedProxy(clientSide = "net.torocraft.torohealthmod.ClientProxy", serverSide = "net.torocraft.torohealthmod.ServerProxy")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.entity.passive.EntitySquid;

public abstract class AbstractHealthDisplay implements ToroHealthDisplay {

protected EntityLivingBase entity;

public static enum Relation {
Expand Down Expand Up @@ -38,6 +38,11 @@ protected Relation determineRelation() {
public void setEntity(EntityLivingBase entity) {
this.entity = entity;
}


public String getEntityName() {
if (entity == null || entity.getDisplayName() == null) {
return "";
}
return entity.getDisplayName().getFormattedText();
}
}
2 changes: 1 addition & 1 deletion java/net/torocraft/torohealthmod/display/BarDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void draw() {
}

public void renderBossHealth() {
String name = entity.getDisplayName().getFormattedText();
String name = getEntityName();
String health = (int) Math.ceil(entity.getHealth()) + "/" + (int) entity.getMaxHealth();

GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void resetToOrigin() {
}

private void drawName() {
gui.drawString(mc.fontRendererObj, entity.getDisplayName().getFormattedText(), x, y, 0xFFFFFF);
gui.drawString(mc.fontRendererObj, getEntityName(), x, y, 0xFFFFFF);
y += 10;
}

Expand Down
9 changes: 8 additions & 1 deletion java/net/torocraft/torohealthmod/display/NumericDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void draw() {
int currentHealthWidth = (int) Math.ceil(96 * (entity.getHealth() / entity.getMaxHealth()));
Gui.drawModalRectWithCustomSizedTexture(x + healthBarX, y + healthBarY, 0.0f, 100.0f, currentHealthWidth, 16, 200.0f, 200.0f);

String name = entity.getDisplayName().getFormattedText();
String name = getEntityName();

gui.drawCenteredString(mc.fontRendererObj, name, x + nameX, y + nameY, 0xFFFFFF);
gui.drawCenteredString(mc.fontRendererObj, (int) Math.ceil(entity.getHealth()) + "/" + (int) entity.getMaxHealth(), x + healthX, y + healthY,
Expand All @@ -63,4 +63,11 @@ public void setEntity(EntityLivingBase entity) {
this.entity = entity;
}

public String getEntityName() {
if (entity == null || entity.getDisplayName() == null) {
return "";
}
return entity.getDisplayName().getFormattedText();
}

}

0 comments on commit 73a4c76

Please sign in to comment.