From 7f0d5d804ff8b327e7f5bc522a2732025dd39545 Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Fri, 16 Jul 2021 03:25:03 -0230 Subject: Added mining bar mode for moveable or static --- .../skyblockhud/config/SBHConfig.java | 44 ++++++++++++++++++++++ .../skyblockhud/mixins/MixinGuiIngameForge.java | 24 ++++++++---- .../skyblockhud/overlay/MiningHud.java | 26 +++++++++---- 3 files changed, 80 insertions(+), 14 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index e5f5443..f26bef3 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -53,6 +53,12 @@ public class SBHConfig extends Config { case "tracker": editOverlay(activeConfigCategory, 130, 70, trackers.trackerPosition); return; + case "drill": + editOverlay(activeConfigCategory, 136, 7, mining.drillBar); + return; + case "heat": + editOverlay(activeConfigCategory, 45, 7, mining.heatBar); + return; } } @@ -320,24 +326,62 @@ public class SBHConfig extends Config { public static class Mining { + @Expose + @ConfigOption(name = "Mining Bars", desc = "") + @ConfigEditorAccordion(id = 4) + public boolean miningBars = false; + + @Expose + @ConfigOption(name = "Bar Mode", desc = "Change the mode of bar. Static mode will allow it to auto replace the xp when drill is held or you are heating up.") + @ConfigEditorDropdown(values = { "Moveable", "Static" }) + @ConfigAccordionId(id = 4) + public int barMode = 1; + @Expose @ConfigOption(name = "Show Drill Bar", desc = "Allows you to show or hide the Drill Bar.") @ConfigEditorBoolean + @ConfigAccordionId(id = 4) public boolean showDrillBar = true; @Expose @ConfigOption(name = "Show Heat Bar", desc = "Allows you to show or hide the Heat Bar.") @ConfigEditorBoolean + @ConfigAccordionId(id = 4) public boolean showHeatBar = true; + @Expose + @ConfigOption(name = "Bar Positions (Requires mode to be Moveable)", desc = "") + @ConfigAccordionId(id = 4) + @ConfigEditorAccordion(id = 5) + public boolean barPositions = false; + + @Expose + @ConfigOption(name = "Drill Bar Position", desc = "Allows you to change the position of the Drill Bar.") + @ConfigEditorButton(runnableId = "drill", buttonText = "Edit") + @ConfigAccordionId(id = 5) + public Position drillBar = new Position(-1, -1); + + @Expose + @ConfigOption(name = "Heat Bar Position", desc = "Allows you to change the position of the Heat Bar.") + @ConfigEditorButton(runnableId = "heat", buttonText = "Edit") + @ConfigAccordionId(id = 5) + public Position heatBar = new Position(-1, -9); + + @Expose + @ConfigOption(name = "Crystal Hollow Waypoints", desc = "") + @ConfigEditorAccordion(id = 6) + public boolean waypoints = false; + @Expose @ConfigOption(name = "Auto Waypoint", desc = "Turns on auto waypoints for the main areas of crystal hollows.") @ConfigEditorBoolean + @ConfigAccordionId(id = 6) public boolean autoWaypoint = true; @Expose @ConfigOption(name = "Chat Waypoint Mode", desc = "Change the mode of the chat waypoint In Chat Bar will allow you to edit it before adding it to your waypoints.") @ConfigEditorDropdown(values = { "Instant Add", "In chat bar" }) + @ConfigAccordionId(id = 6) public int chatWaypointMode = 1; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java index 2bba720..6a4213d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java @@ -1,7 +1,5 @@ package com.thatgravyboat.skyblockhud.mixins; -import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; - import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.overlay.MiningHud; @@ -16,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*; + @Mixin(GuiIngameForge.class) public class MixinGuiIngameForge { @@ -64,11 +64,13 @@ public class MixinGuiIngameForge { ci.cancel(); if (prePost(EXPERIENCE, eventParent)) return; postPost(EXPERIENCE, eventParent); - } else if (!SkyblockHud.config.renderer.hideXpBar && (SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar) && SkyblockHud.hasSkyblockScoreboard()) { - if (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { - ci.cancel(); - 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 (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { + ci.cancel(); + if (prePost(EXPERIENCE, eventParent)) return; + postPost(EXPERIENCE, eventParent); + } } } } @@ -79,6 +81,14 @@ public class MixinGuiIngameForge { ci.cancel(); 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 (MiningHud.getHeat() > 0 || Utils.isDrill(Minecraft.getMinecraft().thePlayer.getHeldItem())) { + ci.cancel(); + if (prePost(JUMPBAR, eventParent)) return; + postPost(JUMPBAR, eventParent); + } + } } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java index 2c2feaa..5a2f148 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java @@ -3,6 +3,7 @@ package com.thatgravyboat.skyblockhud.overlay; import com.thatgravyboat.skyblockhud.GuiTextures; import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; +import com.thatgravyboat.skyblockhud.core.config.Position; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; @@ -32,13 +33,24 @@ public class MiningHud extends Gui { if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.mining.showDrillBar || SkyblockHud.config.mining.showHeatBar)) { Minecraft mc = Minecraft.getMinecraft(); - if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar && 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) { - 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); + if (SkyblockHud.config.mining.barMode == 1) { + if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.mining.showDrillBar && 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) { + 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); + } + }else if (SkyblockHud.config.mining.barMode == 0) { + if (heat > 0 && SkyblockHud.config.mining.showHeatBar){ + 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){ + Position position = SkyblockHud.config.mining.drillBar; + renderFuelBar(mc, position.getAbsX(event.resolution, 136), position.getAbsY(event.resolution, 7)); + } } } } -- cgit