From 65496c9270fd3740dad84e0cfa600a64be3ad3a2 Mon Sep 17 00:00:00 2001 From: sor1n Date: Sun, 17 May 2020 17:08:41 +0100 Subject: [PATCH] Added more Config Options --- .../torohud/conf/HealthBarGuiConf.java | 44 +++++++++++++++++++ .../torocraft/torohud/display/BarDisplay.java | 38 +++++++++++----- 2 files changed, 72 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/torocraft/torohud/conf/HealthBarGuiConf.java b/src/main/java/net/torocraft/torohud/conf/HealthBarGuiConf.java index 4349e07..d448619 100644 --- a/src/main/java/net/torocraft/torohud/conf/HealthBarGuiConf.java +++ b/src/main/java/net/torocraft/torohud/conf/HealthBarGuiConf.java @@ -24,6 +24,50 @@ public enum Skin {NONE, BASIC} @Name("Show 3D Model of Entity") public static boolean showEntityModel = true; // config.getBoolean("Show 3D Model of Entity", Configuration.CATEGORY_CLIENT, true, "Shows a 3D model of the entity being targeted"); + // Health Config + @Name("Hide Health Number") + @Comment("Hide the health number") + public static boolean hideHealthNo = false; + + @Name("Health Number X Offset") + public static int healthNoXOffset = 0; + + @Name("Health Number Y Offset") + public static int healthNoYOffset = 0; + + @Name("Health Bar X Offset") + public static int healthXOffset = 0; + + @Name("Health Bar Y Offset") + public static int healthYOffset = 0; + + @Name("Health Bar Scale") + public static float healthScale = 1f; + + // Nameplate Config + @Name("Hide Nameplate") + public static boolean hideName = false; + + @Name("Nameplate X Offset") + public static int nameXOffset = 0; + + @Name("Nameplate Y Offset") + public static int nameYOffset = 0; + + @Name("Nameplate Scale") + public static float nameScale = 1f; + + // Armor Config + @Name("Hide Armor") + public static boolean hideArmor = false; + + @Name("Armor X Offset") + public static int armorXOffset = 0; + + @Name("Armor Y Offset") + public static int armorYOffset = 0; + + // Overall GUI Config @Name("Disable GUI") public static boolean disableGui = false; diff --git a/src/main/java/net/torocraft/torohud/display/BarDisplay.java b/src/main/java/net/torocraft/torohud/display/BarDisplay.java index 780dad5..ca81caa 100644 --- a/src/main/java/net/torocraft/torohud/display/BarDisplay.java +++ b/src/main/java/net/torocraft/torohud/display/BarDisplay.java @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.torocraft.torohud.gui.HealthBars; +import net.torocraft.torohud.conf.HealthBarGuiConf; public class BarDisplay extends AbstractEntityDisplay implements IDisplay { @@ -43,21 +44,38 @@ public void render() { String health = (int) Math.ceil(entity.getHealth()) + "/" + (int) entity.getMaxHealth(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - HealthBars.drawEntityHealthBarInGui(gui, entity, barX, barY); - mc.fontRenderer.drawStringWithShadow(name, barX, y + 2, 16777215); - barX += mc.fontRenderer.getStringWidth(name) + 5; + GlStateManager.pushMatrix(); + GlStateManager.scale(HealthBarGuiConf.healthScale, HealthBarGuiConf.healthScale, HealthBarGuiConf.healthScale); + HealthBars.drawEntityHealthBarInGui(gui, entity, barX + HealthBarGuiConf.healthXOffset, barY + HealthBarGuiConf.healthXOffset); + GlStateManager.popMatrix(); + + if(!HealthBarGuiConf.hideName) + { + GlStateManager.pushMatrix(); + GlStateManager.scale(HealthBarGuiConf.nameScale, HealthBarGuiConf.nameScale, HealthBarGuiConf.nameScale); + mc.fontRenderer.drawStringWithShadow(name, barX + HealthBarGuiConf.nameXOffset, y + 2 + HealthBarGuiConf.nameYOffset, 16777215); + GlStateManager.popMatrix(); + + barX += mc.fontRenderer.getStringWidth(name) + 5 + HealthBarGuiConf.nameXOffset; + } - renderHeartIcon(barX, y + 1); - barX += 10; + if(!HealthBarGuiConf.hideHealthNo) + { + renderHeartIcon(barX + HealthBarGuiConf.healthNoXOffset, y + 1 + HealthBarGuiConf.healthNoYOffset); + barX += 10 + HealthBarGuiConf.healthNoXOffset; - mc.fontRenderer.drawStringWithShadow(health, barX, y + 2, 0xe0e0e0); - barX += mc.fontRenderer.getStringWidth(health) + 5; + mc.fontRenderer.drawStringWithShadow(health, barX, y + 2, 0xe0e0e0); + barX += mc.fontRenderer.getStringWidth(health) + 5; + } - renderArmorIcon(barX, y + 1); - barX += 10; + if(!HealthBarGuiConf.hideArmor) + { + renderArmorIcon(barX + HealthBarGuiConf.armorXOffset, y + 1 + HealthBarGuiConf.armorYOffset); + barX += 10 + HealthBarGuiConf.armorXOffset; - mc.fontRenderer.drawStringWithShadow(entity.getTotalArmorValue() + "", barX, y + 2, 0xe0e0e0); + mc.fontRenderer.drawStringWithShadow(entity.getTotalArmorValue() + "", barX, y + 2, 0xe0e0e0); + } } private void renderArmorIcon(int x, int y) {