diff options
author | ThatGravyBoat <ThatGravyBoat@users.noreply.github.com> | 2021-07-11 21:28:26 +0000 |
---|---|---|
committer | GitHub Action <actions@github.com> | 2021-07-11 21:28:26 +0000 |
commit | e616a0910bdf7f4540f2814a35c1b7eefa9cd59d (patch) | |
tree | e1ec5d961ef3a0b2337f9794176b3fac3ae299d2 /src/main/java/com/thatgravyboat/skyblockhud/overlay | |
parent | 3a1917c8a0af4157cc1e6d5f3986e89377f245d8 (diff) | |
download | SkyblockHud-Death-Defied-e616a0910bdf7f4540f2814a35c1b7eefa9cd59d.tar.gz SkyblockHud-Death-Defied-e616a0910bdf7f4540f2814a35c1b7eefa9cd59d.tar.bz2 SkyblockHud-Death-Defied-e616a0910bdf7f4540f2814a35c1b7eefa9cd59d.zip |
Prettified Code!
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/overlay')
3 files changed, 20 insertions, 22 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java index 57044df..273f98d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/MiningHud.java @@ -14,12 +14,12 @@ public class MiningHud extends Gui { private static int fuel, maxFuel; private static int heat; - public static void setFuel(int fuel, int maxFuel){ + public static void setFuel(int fuel, int maxFuel) { MiningHud.fuel = fuel; MiningHud.maxFuel = maxFuel; } - public static void setHeat(int heat){ + public static void setHeat(int heat) { MiningHud.heat = heat; } @@ -31,30 +31,30 @@ public class MiningHud extends Gui { if (heat > 0 && Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.miningHud.showDrillBar && SkyblockHud.config.miningHud.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.miningHud.showDrillBar) { + } else if (Utils.isDrill(mc.thePlayer.getHeldItem()) && SkyblockHud.config.miningHud.showDrillBar) { renderFuelBar(mc, (event.resolution.getScaledWidth() / 2) - 68, event.resolution.getScaledHeight() - 31); - }else if (heat > 0 && SkyblockHud.config.miningHud.showHeatBar){ + } else if (heat > 0 && SkyblockHud.config.miningHud.showHeatBar) { renderHeatBar(mc, (event.resolution.getScaledWidth() / 2) - 22, event.resolution.getScaledHeight() - 31); } } } - private void renderFuelBar(Minecraft mc, int x, int y){ - if (maxFuel == 0)return; + private void renderFuelBar(Minecraft mc, int x, int y) { + if (maxFuel == 0) return; GlStateManager.enableBlend(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); mc.renderEngine.bindTexture(GuiTextures.mining); 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); + 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); } - private void renderHeatBar(Minecraft mc, int x, int y){ + private void renderHeatBar(Minecraft mc, int x, int y) { GlStateManager.enableBlend(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); mc.renderEngine.bindTexture(GuiTextures.mining); drawTexturedModalRect(x, y, 137, 0, 45, 7); - drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat/100f,0,45), 7); + drawTexturedModalRect(x, y, 137, 7, Utils.lerp(heat / 100f, 0, 45), 7); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index a7a8b4e..a1e1f54 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -10,6 +10,9 @@ import com.thatgravyboat.skyblockhud.handlers.TimeHandler; import com.thatgravyboat.skyblockhud.location.*; import com.thatgravyboat.skyblockhud.seasons.Season; import com.thatgravyboat.skyblockhud.seasons.SeasonDateHandler; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -20,10 +23,6 @@ import net.minecraftforge.client.GuiIngameForge; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.util.Locale; - public class OverlayHud extends Gui { private static final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; @@ -216,7 +215,7 @@ public class OverlayHud extends Gui { drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(mithril) + 14, 14); drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, offset + (bossBarVisible ? 38 : 21), 91, 0, 8, 8); drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); - }else { + } else { LocationCategory locationCategory = LocationHandler.getCurrentLocation().getCategory(); String mithril = locationCategory == LocationCategory.DWARVENMINES ? MinesHandler.getMithrilFormatted() : MinesHandler.getMithrilShortFormatted(); String gemstone = locationCategory == LocationCategory.CRYSTALHOLLOWS ? MinesHandler.getGemstoneFormatted() : MinesHandler.getGemstoneShortFormatted(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index 3914392..9d0f00d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -6,6 +6,8 @@ import com.thatgravyboat.skyblockhud.SkyblockHud; import com.thatgravyboat.skyblockhud.Utils; import com.thatgravyboat.skyblockhud.core.config.Position; import com.thatgravyboat.skyblockhud.handlers.HeldItemHandler; +import java.text.DecimalFormat; +import java.text.NumberFormat; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -13,9 +15,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.text.DecimalFormat; -import java.text.NumberFormat; - public class RPGHud extends Gui { private static int mana, maxMana, overflow = 0; @@ -74,13 +73,13 @@ public class RPGHud extends Gui { float manaWidth = Math.min(57 * ((float) mana / (float) maxMana), 57); int manaX = rightAligned ? x + 16 : 47 + x; - if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())){ + if (HeldItemHandler.hasManaCost(mc.thePlayer.getHeldItem())) { int manaCost = HeldItemHandler.getManaCost(mc.thePlayer.getHeldItem()); drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, manaCost > mana ? 96 : 64, (int) manaWidth, 4); if (manaCost <= mana) { - drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana,0, 57), 4); + drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 92, Utils.lerp((float) manaCost / (float) maxMana, 0, 57), 4); } - }else { + } else { drawTexturedModalRect(manaX, 17 + y, rightAligned ? 199 : 0, 64, (int) manaWidth, 4); } |