diff options
author | nea <romangraef@gmail.com> | 2022-08-23 18:20:16 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-23 18:20:16 +0200 |
commit | 1e870d3d55b4965c24919c0a69bdd2fa4958b7f8 (patch) | |
tree | d741b50ec639e723259e1d1341c7a8abc98d8c8e | |
parent | 50f5ff6cf4fb9fc37270114317d0192788c1c64e (diff) | |
download | SkyblockHud-Death-Defied-1e870d3d55b4965c24919c0a69bdd2fa4958b7f8.tar.gz SkyblockHud-Death-Defied-1e870d3d55b4965c24919c0a69bdd2fa4958b7f8.tar.bz2 SkyblockHud-Death-Defied-1e870d3d55b4965c24919c0a69bdd2fa4958b7f8.zip |
Allow Drill bar to be absolute valuesdrillbar
4 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 1d937a6..f06ddff 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -375,9 +375,9 @@ public class SBHConfig extends Config { @Expose @ConfigOption(name = "Show Drill Bar", desc = "Allows you to show or hide the Drill Bar.") - @ConfigEditorBoolean @ConfigAccordionId(id = 4) - public boolean showDrillBar = true; + @ConfigEditorDropdown(values = {"Do not Show", "Show percentage", "Show total value"}, initialIndex = 1) + public int showDrillBar = 1; @Expose @ConfigOption(name = "Show Heat Bar", desc = "Allows you to show or hide the Heat Bar.") diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java index eaa1b5a..0957350 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java @@ -65,7 +65,7 @@ public class MixinGuiIngameForge { if (prePost(EXPERIENCE, eventParent)) return; postPost(EXPERIENCE, eventParent); } else if (SkyblockHud.config.mining.barMode == 1) { - if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { + if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar != 0 || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { ci.cancel(); if (prePost(EXPERIENCE, eventParent)) return; @@ -82,7 +82,7 @@ public class MixinGuiIngameForge { if (prePost(JUMPBAR, eventParent)) return; postPost(JUMPBAR, eventParent); } else if (SkyblockHud.config.mining.barMode == 1) { - if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { + if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar != 0 || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { ci.cancel(); if (prePost(JUMPBAR, eventParent)) return; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java index a3aab50..063a74f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java @@ -30,14 +30,14 @@ public class MiningHud extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { - if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar)) { + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.mining.showDrillBar != 0 || SkyblockHud.config.mining.showHeatBar)) { Minecraft mc = Minecraft.getMinecraft(); if (SkyblockHud.config.mining.barMode == 1) { - if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar && SkyblockHud.config.mining.showHeatBar) { + if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar != 0 && SkyblockHud.config.mining.showHeatBar) { renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 91, event.resolution.getScaledHeight() - 31); renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) + 46, event.resolution.getScaledHeight() - 31); - } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar) { + } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar != 0) { renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 68, event.resolution.getScaledHeight() - 31); } else if (heat > 0 && SkyblockHud.config.mining.showHeatBar) { renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) - 22, event.resolution.getScaledHeight() - 31); @@ -47,7 +47,7 @@ public class MiningHud extends Gui { Position position = SkyblockHud.config.mining.heatBar; renderHeatBar(mc, position.getAbsX(event.resolution, 45), position.getAbsY(event.resolution, 7)); } - if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar) { + if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar != 0) { Position position = SkyblockHud.config.mining.drillBar; renderFuelBar(mc, position.getAbsX(event.resolution, 136), position.getAbsY(event.resolution, 7)); } @@ -62,8 +62,14 @@ public class MiningHud extends Gui { mc.renderEngine.bindTexture(Textures.texture.mines); drawTexturedModalRect(x, y, 0, 0, 136, 7); drawTexturedModalRect(x, y, 0, 7, Utils.lerp((float) fuel / (float) maxFuel, 0, 136), 7); - String percentageText = Math.round(((float) fuel / (float) maxFuel) * 100) + "%"; - this.drawCenteredString(mc.fontRendererObj, percentageText, x + 68, y - 2, 0xffffff); + + String renderedText; + if (SkyblockHud.config.mining.showDrillBar == 1) { + renderedText = Math.round(((float) fuel / (float) maxFuel) * 100) + "%"; + } else { + renderedText = fuel + "/" + maxFuel; + } + this.drawCenteredString(mc.fontRendererObj, renderedText, x + 68, y - 2, 0xffffff); } private void renderHeatBar(Minecraft mc, int x, int y) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index 380f4a5..1151f8a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -57,7 +57,7 @@ public class ActionBarParsing { if (SkyblockHud.hasSkyblockScoreboard() && SkyblockHud.config.rpg.showRpgHud) { parseActionBar(event.message.getUnformattedText()); } - if (SkyblockHud.config.mining.showDrillBar) { + if (SkyblockHud.config.mining.showDrillBar != 0) { String bar = Utils.removeColor(event.message.getUnformattedText()); Matcher DrillFuelMatcher = DrillFuelRegex.matcher(bar); if (DrillFuelMatcher.find()) { @@ -91,7 +91,7 @@ public class ActionBarParsing { } event.message = lastLowEditedActionBar; } - if (SkyblockHud.config.mining.showDrillBar) { + if (SkyblockHud.config.mining.showDrillBar != 0) { event.message = new ChatComponentText(DrillFuelReplaceRegex.matcher(event.message.getUnformattedText()).replaceAll("").trim()); } } |