diff options
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud')
38 files changed, 200 insertions, 980 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 0f4713f..ad7b1e8 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -33,8 +33,7 @@ public class ComponentHandler { boolean eventPass = false; if (mc.theWorld != null) { List<NetworkPlayerInfo> players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); - GuiIngameForge.renderObjective = - !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; + GuiIngameForge.renderObjective = !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; if (players != null && SkyblockHud.hasSkyblockScoreboard()) { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { @@ -43,33 +42,24 @@ public class ComponentHandler { .matcher(Utils.removeColor(player.getDisplayName().getFormattedText())) .replaceAll(""); if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - if ( - formattedTabListPlayer.toLowerCase().contains("secrets found:") - ) DungeonHandler.parseTotalSecrets(formattedTabListPlayer); - if ( - formattedTabListPlayer.toLowerCase().contains("deaths:") - ) DungeonHandler.parseDeaths(formattedTabListPlayer); - if ( - formattedTabListPlayer.toLowerCase().contains("crypts:") - ) DungeonHandler.parseCrypts(formattedTabListPlayer); - } else if ( - LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES) - ) { + if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets( + formattedTabListPlayer + ); + if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths( + formattedTabListPlayer + ); + if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts( + formattedTabListPlayer + ); + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES)) { if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { DwarvenMineHandler.parseMithril(formattedTabListPlayer); } - } else if ( - LocationHandler - .getCurrentLocation() - .getCategory() - .equals(LocationCategory.MUSHROOMDESERT) - ) { + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { FarmingIslandHandler.pelts = - Integer.parseInt( - formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim() - ); + Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); } catch (Exception ignored) {} } } @@ -85,16 +75,9 @@ public class ComponentHandler { if (i < 80) { if (players.get(i + 1).getDisplayName() != null) { String secondLine = SCOREBOARD_CHARACTERS - .matcher( - Utils.removeColor( - players.get(i + 1).getDisplayName().getFormattedText() - ) - ) + .matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())) .replaceAll(""); - SeasonDateHandler.setCurrentEvent( - formattedTabListPlayer.replace("Event:", ""), - secondLine - ); + SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); eventPass = true; } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java b/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java index af6b49c..9198433 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java @@ -20,27 +20,13 @@ public class GuiTextures { public static final ResourceLocation THREE = new ResourceLocation("skyblockhud:core/toggle_3.png"); public static final ResourceLocation ON = new ResourceLocation("skyblockhud:core/toggle_on.png"); - public static final ResourceLocation slider_off_cap = new ResourceLocation( - "skyblockhud:core/slider/slider_off_cap.png" - ); - public static final ResourceLocation slider_off_notch = new ResourceLocation( - "skyblockhud:core/slider/slider_off_notch.png" - ); - public static final ResourceLocation slider_off_segment = new ResourceLocation( - "skyblockhud:core/slider/slider_off_segment.png" - ); - public static final ResourceLocation slider_on_cap = new ResourceLocation( - "skyblockhud:core/slider/slider_on_cap.png" - ); - public static final ResourceLocation slider_on_notch = new ResourceLocation( - "skyblockhud:core/slider/slider_on_notch.png" - ); - public static final ResourceLocation slider_on_segment = new ResourceLocation( - "skyblockhud:core/slider/slider_on_segment.png" - ); - public static final ResourceLocation slider_button_new = new ResourceLocation( - "skyblockhud:core/slider/slider_button.png" - ); + public static final ResourceLocation slider_off_cap = new ResourceLocation("skyblockhud:core/slider/slider_off_cap.png"); + public static final ResourceLocation slider_off_notch = new ResourceLocation("skyblockhud:core/slider/slider_off_notch.png"); + public static final ResourceLocation slider_off_segment = new ResourceLocation("skyblockhud:core/slider/slider_off_segment.png"); + public static final ResourceLocation slider_on_cap = new ResourceLocation("skyblockhud:core/slider/slider_on_cap.png"); + public static final ResourceLocation slider_on_notch = new ResourceLocation("skyblockhud:core/slider/slider_on_notch.png"); + public static final ResourceLocation slider_on_segment = new ResourceLocation("skyblockhud:core/slider/slider_on_segment.png"); + public static final ResourceLocation slider_button_new = new ResourceLocation("skyblockhud:core/slider/slider_button.png"); public static final ResourceLocation overlay = new ResourceLocation("skyblockhud", "stats.png"); public static final ResourceLocation dungeon = new ResourceLocation("skyblockhud", "dungeon.png"); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 8cd8baf..071d120 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -51,10 +51,7 @@ public class SkyblockHud { private File configFile; - private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet( - "SKYBLOCK", - "\u7A7A\u5C9B\u751F\u5B58" - ); + private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58"); private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); @@ -90,9 +87,7 @@ public class SkyblockHud { if (configFile.exists()) { try ( - BufferedReader reader = new BufferedReader( - new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) ) { config = gson.fromJson(reader, SBHConfig.class); } catch (Exception ignored) {} @@ -114,9 +109,7 @@ public class SkyblockHud { configFile.createNewFile(); try ( - BufferedWriter writer = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) ) { writer.write(gson.toJson(config)); } @@ -181,13 +174,7 @@ public class SkyblockHud { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBar(ClientChatReceivedEvent event) { - if ( - Utils - .removeColor(event.message.getUnformattedText()) - .toLowerCase() - .trim() - .startsWith("your profile was changed to:") - ) { + if (Utils.removeColor(event.message.getUnformattedText()).toLowerCase().trim().startsWith("your profile was changed to:")) { MinecraftForge.EVENT_BUS.post(new ProfileSwitchedEvent()); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java index f03c6c0..56b5f56 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java @@ -39,12 +39,7 @@ public class Utils { public static boolean isPlayerHoldingRedstone(EntityPlayerSP player) { if (!SkyblockHud.config.main.requireRedstone) return true; ArrayList<Item> redstoneItems = new ArrayList<>( - Arrays.asList( - Items.redstone, - Items.repeater, - Items.comparator, - Item.getByNameOrId("minecraft:redstone_torch") - ) + Arrays.asList(Items.redstone, Items.repeater, Items.comparator, Item.getByNameOrId("minecraft:redstone_torch")) ); if (player.getHeldItem() != null) return redstoneItems.contains(player.getHeldItem().getItem()); return false; @@ -138,15 +133,7 @@ public class Utils { return (shouldRender && ((type == null && Loader.isModLoaded("labymod")) || type == checkType)); } - public static void drawStringScaledMaxWidth( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) { int strLen = fr.getStringWidth(str); float factor = len / (float) strLen; factor = Math.min(1, factor); @@ -154,29 +141,13 @@ public class Utils { drawStringScaled(str, fr, x, y, shadow, colour, factor); } - public static void drawStringScaled( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int colour, - float factor - ) { + public static void drawStringScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int colour, float factor) { GlStateManager.scale(factor, factor, 1); fr.drawString(str, x / factor, y / factor, colour, shadow); GlStateManager.scale(1 / factor, 1 / factor, 1); } - public static void drawStringCenteredScaled( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringCenteredScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) { int strLen = fr.getStringWidth(str); float factor = len / (float) strLen; float fontHeight = 8 * factor; @@ -197,12 +168,7 @@ public class Utils { ) { GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate( - GL11.GL_SRC_ALPHA, - GL11.GL_ONE_MINUS_SRC_ALPHA, - GL11.GL_ONE, - GL11.GL_ONE_MINUS_SRC_ALPHA - ); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter); @@ -230,16 +196,7 @@ public class Utils { drawTexturedRect(x, y, width, height, 0, 1, 0, 1, filter); } - public static void drawTexturedRect( - float x, - float y, - float width, - float height, - float uMin, - float uMax, - float vMin, - float vMax - ) { + public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax) { drawTexturedRect(x, y, width, height, uMin, uMax, vMin, vMax, GL11.GL_LINEAR); } @@ -271,9 +228,7 @@ public class Utils { } } - int newScale = guiScales.size() > 0 - ? Math.max(0, Math.min(4, guiScales.peek())) - : Minecraft.getMinecraft().gameSettings.guiScale; + int newScale = guiScales.size() > 0 ? Math.max(0, Math.min(4, guiScales.peek())) : Minecraft.getMinecraft().gameSettings.guiScale; if (newScale == 0) newScale = Minecraft.getMinecraft().gameSettings.guiScale; int oldScale = Minecraft.getMinecraft().gameSettings.guiScale; @@ -282,12 +237,7 @@ public class Utils { Minecraft.getMinecraft().gameSettings.guiScale = oldScale; if (guiScales.size() > 0) { - GlStateManager.viewport( - 0, - 0, - Minecraft.getMinecraft().displayWidth, - Minecraft.getMinecraft().displayHeight - ); + GlStateManager.viewport(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho( diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java index 8d6002b..db9ad38 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java @@ -35,14 +35,9 @@ public class LeaderboardGetter { Scoreboard scoreboard = mc.theWorld.getScoreboard(); ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1); - if ( - sidebarObjective != null && - !MinecraftForge.EVENT_BUS.post(new SidebarPreGetEvent(scoreboard, sidebarObjective)) - ) { + if (sidebarObjective != null && !MinecraftForge.EVENT_BUS.post(new SidebarPreGetEvent(scoreboard, sidebarObjective))) { Collection<Score> scoreList = sidebarObjective.getScoreboard().getSortedScores(sidebarObjective); - Map<Integer, String> scores = scoreList - .stream() - .collect(Collectors.toMap(Score::getScorePoints, this::getLine)); + Map<Integer, String> scores = scoreList.stream().collect(Collectors.toMap(Score::getScorePoints, this::getLine)); if (!cachedScores.equals(scores)) { scores.forEach( diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 84e5483..c8f6d53 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -21,9 +21,7 @@ public class SBHConfig extends Config { height, () -> {}, () -> {}, - () -> - SkyblockHud.screenToOpen = - new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) + () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) ) ); } @@ -113,10 +111,7 @@ public class SBHConfig extends Config { public Position mainHudPos = new Position(0, 1, true, false); @Expose - @ConfigOption( - name = "Twelve Hour Clock", - desc = "Allows you to change the clock to be 12 hour instead of 24 hour." - ) + @ConfigOption(name = "Twelve Hour Clock", desc = "Allows you to change the clock to be 12 hour instead of 24 hour.") @ConfigEditorBoolean public boolean twelveHourClock = false; @@ -196,10 +191,7 @@ public class SBHConfig extends Config { public boolean hideDungeonPlayers = false; @Expose - @ConfigOption( - name = "Dungeon Player Opacity", - desc = "Allows you to change the opacity of the dungeon players." - ) + @ConfigOption(name = "Dungeon Player Opacity", desc = "Allows you to change the opacity of the dungeon players.") @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) @ConfigAccordionId(id = 1) public int dungeonPlayerOpacity = 0; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 3bac8ac..7dee8e6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -30,10 +30,7 @@ import org.lwjgl.opengl.GL11; public class SBHConfigEditor extends GuiElement { private static final ResourceLocation[] socialsIco = new ResourceLocation[] { DISCORD, TWITTER }; - private static final String[] socialsLink = new String[] { - "https://discord.gg/moulberry", - "https://twitter.com/thatgravytboat/" - }; + private static final String[] socialsLink = new String[] { "https://discord.gg/moulberry", "https://twitter.com/thatgravytboat/" }; private final long openedMillis; @@ -89,9 +86,7 @@ public class SBHConfigEditor extends GuiElement { return new LinkedHashMap<>(processedConfig); } - private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory( - ConfigProcessor.ProcessedCategory cat - ) { + private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory(ConfigProcessor.ProcessedCategory cat) { return new LinkedHashMap<>(cat.options); } @@ -217,10 +212,7 @@ public class SBHConfigEditor extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, fr, x + 75, y + 70 + catY, false, 100, -1); catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue()) - ); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue())); } } @@ -231,16 +223,12 @@ public class SBHConfigEditor extends GuiElement { if (categoryScroll.getTarget() / (float) (catY + categoryScroll.getValue()) + catBarSize < 1) { int target = optionsScroll.getTarget(); categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); categoryScroll.setTarget(target); } else { categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); } } @@ -322,10 +310,7 @@ public class SBHConfigEditor extends GuiElement { } GlStateManager.disableDepth(); if (optionY > 0) { - barSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue()) - ); + barSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue())); } } @@ -360,15 +345,8 @@ public class SBHConfigEditor extends GuiElement { } } int optionHeight = editor.getHeight(); - if ( - innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && - innerTop + 5 + optionYOverlay < innerBottom - 1 - ) { - editor.renderOverlay( - (innerLeft + innerRight - optionWidth) / 2 - 5, - innerTop + 5 + optionYOverlay, - optionWidth - ); + if (innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && innerTop + 5 + optionYOverlay < innerBottom - 1) { + editor.renderOverlay((innerLeft + innerRight - optionWidth) / 2 - 5, innerTop + 5 + optionYOverlay, optionWidth); } optionYOverlay += optionHeight + 5; } @@ -384,16 +362,12 @@ public class SBHConfigEditor extends GuiElement { if (optionsScroll.getTarget() / (float) (optionY + optionsScroll.getValue()) + barSize < 1) { int target = optionsScroll.getTarget(); optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); optionsScroll.setTarget(target); } else { optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); } } @@ -415,9 +389,7 @@ public class SBHConfigEditor extends GuiElement { if (mouseX >= socialLeft && mouseX <= socialLeft + 16 && mouseY >= y + 6 && mouseY <= y + 23) { tooltipToDisplay = - Lists.newArrayList( - EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex] - ); + Lists.newArrayList(EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex]); } } @@ -465,16 +437,14 @@ public class SBHConfigEditor extends GuiElement { float catBarSize = 1; int catY = -newTarget; - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) { if (getSelectedCategory() == null) { setSelectedCategory(entry.getKey()); } catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); } } @@ -519,10 +489,7 @@ public class SBHConfigEditor extends GuiElement { optionY += editor.getHeight() + 5; if (optionY > 0) { - barSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (optionY + 5 + newTarget) - ); + barSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (optionY + 5 + newTarget)); } } } @@ -531,26 +498,18 @@ public class SBHConfigEditor extends GuiElement { if (newTarget > barMax) { newTarget = barMax; } - optionsScroll.setTimeToReachTarget( - Math.min(150, Math.max(10, 5 * Math.abs(newTarget - optionsScroll.getValue()))) - ); + optionsScroll.setTimeToReachTarget(Math.min(150, Math.max(10, 5 * Math.abs(newTarget - optionsScroll.getValue())))); optionsScroll.resetTimer(); optionsScroll.setTarget(newTarget); } } else if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) { if (getCurrentConfigEditing() != null) { int catY = -categoryScroll.getValue(); - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) { if (getSelectedCategory() == null) { setSelectedCategory(entry.getKey()); } - if ( - mouseX >= x + 5 && - mouseX <= x + 145 && - mouseY >= y + 70 + catY - 7 && - mouseY <= y + 70 + catY + 7 - ) { + if (mouseX >= x + 5 && mouseX <= x + 145 && mouseY >= y + 70 + catY - 7 && mouseY <= y + 70 + catY + 7) { setSelectedCategory(entry.getKey()); return true; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java index e41b7b3..8daf4b1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementBoolean.java @@ -96,12 +96,7 @@ public class GuiElementBoolean extends GuiElement { @Override public boolean mouseInput(int mouseX, int mouseY) { - if ( - mouseX > x - clickRadius && - mouseX < x + xSize + clickRadius && - mouseY > y - clickRadius && - mouseY < y + ySize + clickRadius - ) { + if (mouseX > x - clickRadius && mouseX < x + xSize + clickRadius && mouseY > y - clickRadius && mouseY < y + ySize + clickRadius) { if (Mouse.getEventButton() == 0) { if (Mouse.getEventButtonState()) { previewValue = !value; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java index a7db23b..7f8b9ba 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java @@ -18,26 +18,14 @@ import org.lwjgl.opengl.GL11; public class GuiElementColour extends GuiElement { - public static final ResourceLocation colour_selector_dot = new ResourceLocation( - "skyblockhud:core/colour_selector_dot.png" - ); - public static final ResourceLocation colour_selector_bar = new ResourceLocation( - "skyblockhud:core/colour_selector_bar.png" - ); - public static final ResourceLocation colour_selector_bar_alpha = new ResourceLocation( - "skyblockhud:core/colour_selector_bar_alpha.png" - ); - public static final ResourceLocation colour_selector_chroma = new ResourceLocation( - "skyblockhud:core/colour_selector_chroma.png" - ); + public static final ResourceLocation colour_selector_dot = new ResourceLocation("skyblockhud:core/colour_selector_dot.png"); + public static final ResourceLocation colour_selector_bar = new ResourceLocation("skyblockhud:core/colour_selector_bar.png"); + public static final ResourceLocation colour_selector_bar_alpha = new ResourceLocation("skyblockhud:core/colour_selector_bar_alpha.png"); + public static final ResourceLocation colour_selector_chroma = new ResourceLocation("skyblockhud:core/colour_selector_chroma.png"); private static final ResourceLocation colourPickerLocation = new ResourceLocation("mbcore:dynamic/colourpicker"); - private static final ResourceLocation colourPickerBarValueLocation = new ResourceLocation( - "mbcore:dynamic/colourpickervalue" - ); - private static final ResourceLocation colourPickerBarOpacityLocation = new ResourceLocation( - "mbcore:dynamic/colourpickeropacity" - ); + private static final ResourceLocation colourPickerBarValueLocation = new ResourceLocation("mbcore:dynamic/colourpickervalue"); + private static final ResourceLocation colourPickerBarOpacityLocation = new ResourceLocation("mbcore:dynamic/colourpickeropacity"); private final GuiElementTextField hexField = new GuiElementTextField( "", GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE @@ -57,13 +45,7 @@ public class GuiElementColour extends GuiElement { private Runnable closeCallback; private String colour; - public GuiElementColour( - int x, - int y, - String initialColour, - Consumer<String> colourChangedCallback, - Runnable closeCallback - ) { + public GuiElementColour(int x, int y, String initialColour, Consumer<String> colourChangedCallback, Runnable closeCallback) { final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); this.y = Math.max(10, Math.min(scaledResolution.getScaledHeight() - ySize - 10, y)); @@ -147,18 +129,12 @@ public class GuiElementColour extends GuiElement { GlStateManager.color(1, 1, 1, 1); RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST); - Minecraft - .getMinecraft() - .getTextureManager() - .loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue)); + Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarValueLocation, new DynamicTexture(bufferedImageValue)); Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarValueLocation); GlStateManager.color(1, 1, 1, 1); RenderUtils.drawTexturedRect(x + 5 + 64 + 5, y + 5, 10, 64, GL11.GL_NEAREST); - Minecraft - .getMinecraft() - .getTextureManager() - .loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity)); + Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerBarOpacityLocation, new DynamicTexture(bufferedImageOpacity)); Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerBarOpacityLocation); GlStateManager.color(1, 1, 1, 1); RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5, y + 5, 10, 64, GL11.GL_NEAREST); @@ -182,11 +158,7 @@ public class GuiElementColour extends GuiElement { y + 5 + 27 + 1, x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10 - 1, y + 5 + 37 - 1, - Color.HSBtoRGB( - (hsvChroma[0] + (System.currentTimeMillis() - ChromaColour.startTime) / 1000f) % 1, - 0.8f, - 0.8f - ) + Color.HSBtoRGB((hsvChroma[0] + (System.currentTimeMillis() - ChromaColour.startTime) / 1000f) % 1, 0.8f, 0.8f) ); } @@ -226,10 +198,7 @@ public class GuiElementColour extends GuiElement { ); } - Minecraft - .getMinecraft() - .getTextureManager() - .loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage)); + Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage)); Minecraft.getMinecraft().getTextureManager().bindTexture(colourPickerLocation); GlStateManager.color(1, 1, 1, 1); RenderUtils.drawTexturedRect(x + 1, y + 1, 72, 72, GL11.GL_LINEAR); @@ -283,9 +252,7 @@ public class GuiElementColour extends GuiElement { public boolean mouseInput(int mouseX, int mouseY) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - float mouseXF = (float) ( - Mouse.getX() * scaledResolution.getScaledWidth_double() / Minecraft.getMinecraft().displayWidth - ); + float mouseXF = (float) (Mouse.getX() * scaledResolution.getScaledWidth_double() / Minecraft.getMinecraft().displayWidth); float mouseYF = (float) ( scaledResolution.getScaledHeight_double() - Mouse.getY() * @@ -366,9 +333,7 @@ public class GuiElementColour extends GuiElement { float angle = (float) Math.toDegrees(Math.atan((32 - xWheel) / (yWheel - 32 + 1E-5)) + Math.PI / 2); xWheel = Math.max(0, Math.min(64, xWheel)); yWheel = Math.max(0, Math.min(64, yWheel)); - float radius = (float) Math.sqrt( - ((xWheel - 32) * (xWheel - 32) + (yWheel - 32) * (yWheel - 32)) / 1024f - ); + float radius = (float) Math.sqrt(((xWheel - 32) * (xWheel - 32) + (yWheel - 32) * (yWheel - 32)) / 1024f); if (yWheel < 32) angle += 180; this.wheelAngle = angle; @@ -391,8 +356,7 @@ public class GuiElementColour extends GuiElement { } if (clickedComponent == 2) { - colour = - ChromaColour.special(ChromaColour.getSpeed(colour), 255 - Math.round(y / 64f * 255), currentColour); + colour = ChromaColour.special(ChromaColour.getSpeed(colour), 255 - Math.round(y / 64f * 255), currentColour); colourChangedCallback.accept(colour); return true; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java index cc002b2..54db59b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java @@ -249,10 +249,7 @@ public class GuiElementTextField { int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6"); String textBeforeCursor = text.substring(0, textField.getSelectionEnd() + colorCodes * 2); - int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches( - textBeforeCursor, - "\n" - ); + int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n"); String[] split = textBeforeCursor.split("\n"); int textBeforeCursorWidth; @@ -265,14 +262,11 @@ public class GuiElementTextField { } else if (split.length > 1) { thisLineBeforeCursor = split[split.length - 1]; lineBefore = split[split.length - 2]; - textBeforeCursorWidth = - Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); + textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); } else { return; } - String trimmed = Minecraft - .getMinecraft() - .fontRendererObj.trimStringToWidth(lineBefore, textBeforeCursorWidth); + String trimmed = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(lineBefore, textBeforeCursorWidth); int linePos = strLenNoColor(trimmed); if (linePos != strLenNoColor(lineBefore)) { char after = lineBefore.charAt(linePos); @@ -283,11 +277,7 @@ public class GuiElementTextField { } } int newPos = - textField.getSelectionEnd() - - strLenNoColor(thisLineBeforeCursor) - - strLenNoColor(lineBefore) - - 1 + - linePos; + textField.getSelectionEnd() - strLenNoColor(thisLineBeforeCursor) - strLenNoColor(lineBefore) - 1 + linePos; if (GuiScreen.isShiftKeyDown()) { textField.setSelectionPos(newPos); @@ -299,10 +289,7 @@ public class GuiElementTextField { int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6"); String textBeforeCursor = text.substring(0, textField.getSelectionEnd() + colorCodes * 2); - int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches( - textBeforeCursor, - "\n" - ); + int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n"); String[] split = textBeforeCursor.split("\n"); String thisLineBeforeCursor; @@ -312,8 +299,7 @@ public class GuiElementTextField { textBeforeCursorWidth = 0; } else if (split.length > 0) { thisLineBeforeCursor = split[split.length - 1]; - textBeforeCursorWidth = - Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); + textBeforeCursorWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth(thisLineBeforeCursor); } else { return; } @@ -321,9 +307,7 @@ public class GuiElementTextField { String[] split2 = textNoColour.split("\n"); if (split2.length > numLinesBeforeCursor + 1) { String lineAfter = split2[numLinesBeforeCursor + 1]; - String trimmed = Minecraft - .getMinecraft() - .fontRendererObj.trimStringToWidth(lineAfter, textBeforeCursorWidth); + String trimmed = Minecraft.getMinecraft().fontRendererObj.trimStringToWidth(lineAfter, textBeforeCursorWidth); int linePos = strLenNoColor(trimmed); if (linePos != strLenNoColor(lineAfter)) { char after = lineAfter.charAt(linePos); @@ -447,13 +431,8 @@ public class GuiElementTextField { for (int yOffI = 0; yOffI < texts.length; yOffI++) { int yOff = yOffI * extraSize; - if ( - isScaling() && - Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) > searchBarXSize - 10 - ) { - scale = - (searchBarXSize - 2) / - (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]); + if (isScaling() && Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) > searchBarXSize - 10) { + scale = (searchBarXSize - 2) / (float) Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]); if (scale > 1) scale = 1; float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) * scale; xStartOffset = (int) ((searchBarXSize - newLen) / 2f); @@ -495,8 +474,7 @@ public class GuiElementTextField { if (split.length <= numLinesBeforeCursor || split.length == 0) { textBeforeCursorWidth = 0; } else { - textBeforeCursorWidth = - (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]) * scale); + textBeforeCursorWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]) * scale); } Gui.drawRect( x + xStartOffset + textBeforeCursorWidth, diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java index 85aa0b7..6cae226 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditor.java @@ -21,15 +21,7 @@ public abstract class GuiOptionEditor { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; RenderUtils.drawFloatingRectDark(x, y, width, height, true); - TextRenderUtils.drawStringCenteredScaledMaxWidth( - option.name, - fr, - x + width / 6f, - y + 13, - true, - width / 3 - 10, - 0xc0c0c0 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(option.name, fr, x + width / 6f, y + 13, true, width / 3 - 10, 0xc0c0c0); int maxLines = 5; float scale = 1; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java index 7868ece..d3dc74f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorButton.java @@ -17,12 +17,7 @@ public class GuiOptionEditorButton extends GuiOptionEditor { private String buttonText; private Config config; - public GuiOptionEditorButton( - ConfigProcessor.ProcessedOption option, - String runnableId, - String buttonText, - Config config - ) { + public GuiOptionEditorButton(ConfigProcessor.ProcessedOption option, String runnableId, String buttonText, Config config) { super(option); this.runnableId = runnableId; this.config = config; @@ -58,12 +53,7 @@ public class GuiOptionEditorButton extends GuiOptionEditor { public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) { if (Mouse.getEventButtonState()) { int height = getHeight(); - if ( - mouseX > x + width / 6 - 24 && - mouseX < x + width / 6 + 24 && - mouseY > y + height - 7 - 14 && - mouseY < y + height - 7 + 2 - ) { + if (mouseX > x + width / 6 - 24 && mouseX < x + width / 6 + 24 && mouseY > y + height - 7 - 14 && mouseY < y + height - 7 + 2) { config.executeRunnable(runnableId); return true; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java index 11175a3..6de0223 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDraggableList.java @@ -74,9 +74,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { ); long currentTime = System.currentTimeMillis(); - float greenBlue = LerpUtils.clampZeroOne( - ((trashHoverTime < 0 ? 250 : 0) + trashHoverTime - currentTime) / 250f - ); + float greenBlue = LerpUtils.clampZeroOne(((trashHoverTime < 0 ? 250 : 0) + trashHoverTime - currentTime) / 250f); GlStateManager.color(1, greenBlue, greenBlue, 1); Minecraft.getMinecraft().getTextureManager().bindTexture(DELETE); Utils.drawTexturedRect(x + width / 6f + 27, y + 45 - 7 - 13, 11, 14, GL11.GL_NEAREST); @@ -106,9 +104,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { 0xffffffff ); } - Minecraft - .getMinecraft() - .fontRendererObj.drawString("\u2261", x + 10, y + 50 + yOff + ySize / 2f - 4, 0xffffff, true); + Minecraft.getMinecraft().fontRendererObj.drawString("\u2261", x + 10, y + 50 + yOff + ySize / 2f - 4, 0xffffff, true); } yOff += ySize; @@ -202,13 +198,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { Minecraft .getMinecraft() - .fontRendererObj.drawString( - "\u2261", - dragOffsetX + mouseX, - dragOffsetY + mouseY + ySize / 2f - 4, - 0xffffff, - true - ); + .fontRendererObj.drawString("\u2261", dragOffsetX + mouseX, dragOffsetY + mouseY + ySize / 2f - 4, 0xffffff, true); } } @@ -292,13 +282,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { return true; } - if ( - Mouse.getEventButton() == 0 && - mouseX > x + 5 && - mouseX < x + width - 5 && - mouseY > y + 45 && - mouseY < y + height - 6 - ) { + if (Mouse.getEventButton() == 0 && mouseX > x + 5 && mouseX < x + width - 5 && mouseY > y + 45 && mouseY < y + height - 6) { int yOff = 0; int i = 0; for (int strIndex : activeText) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java index 43a04d7..260c2ad 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorDropdown.java @@ -17,12 +17,7 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { private int selected; private boolean open = false; - public GuiOptionEditorDropdown( - ConfigProcessor.ProcessedOption option, - String[] values, - int selected, - boolean useOrdinal - ) { + public GuiOptionEditorDropdown(ConfigProcessor.ProcessedOption option, String[] values, int selected, boolean useOrdinal) { super(option); if (selected >= values.length) selected = values.length; this.values = values; @@ -48,25 +43,9 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { } RenderUtils.drawFloatingRectDark(left, top, dropdownWidth, 14, false); - TextRenderUtils.drawStringScaled( - "\u25BC", - fr, - left + dropdownWidth - 10, - y + height - 7 - 15, - false, - 0xffa0a0a0, - 2 - ); - - TextRenderUtils.drawStringScaledMaxWidth( - selectedString, - fr, - left + 3, - top + 3, - false, - dropdownWidth - 16, - 0xffa0a0a0 - ); + TextRenderUtils.drawStringScaled("\u25BC", fr, left + dropdownWidth - 10, y + height - 7 - 15, false, 0xffa0a0a0, 2); + + TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0); } } @@ -102,37 +81,13 @@ public class GuiOptionEditorDropdown extends GuiOptionEditor { if (option.isEmpty()) { option = "<NONE>"; } - TextRenderUtils.drawStringScaledMaxWidth( - option, - fr, - left + 3, - top + 3 + dropdownY, - false, - dropdownWidth - 6, - 0xffa0a0a0 - ); + TextRenderUtils.drawStringScaledMaxWidth(option, fr, left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0); dropdownY += 12; } - TextRenderUtils.drawStringScaled( - "\u25B2", - fr, - left + dropdownWidth - 10, - y + height - 7 - 15, - false, - 0xffa0a0a0, - 2 - ); - - TextRenderUtils.drawStringScaledMaxWidth( - selectedString, - fr, - left + 3, - top + 3, - false, - dropdownWidth - 16, - 0xffa0a0a0 - ); + TextRenderUtils.drawStringScaled("\u25B2", fr, left + dropdownWidth - 10, y + height - 7 - 15, false, 0xffa0a0a0, 2); + + TextRenderUtils.drawStringScaledMaxWidth(selectedString, fr, left + 3, top + 3, false, dropdownWidth - 16, 0xffa0a0a0); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java index 2932e34..1e27684 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorSlider.java @@ -13,12 +13,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor { private final GuiElementSlider slider; private final GuiElementTextField textField; - public GuiOptionEditorSlider( - ConfigProcessor.ProcessedOption option, - float minValue, - float maxValue, - float minStep - ) { + public GuiOptionEditorSlider(ConfigProcessor.ProcessedOption option, float minValue, float maxValue, float minStep) { super(option); if (minStep < 0) minStep = 0.01f; @@ -81,9 +76,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor { textField.setSize(Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10, 16); } else { textField.setSize(textFieldWidth, 16); - textField.setOptions( - GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT - ); + textField.setOptions(GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT); } textField.render(x + width / 6 - fullWidth / 2 + sliderWidth + 5, y + height - 7 - 14); @@ -114,12 +107,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor { textField.setSize(textFieldWidth, 16); if (Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) { - if ( - mouseX > textFieldX && - mouseX < textFieldX + textFieldWidth && - mouseY > textFieldY && - mouseY < textFieldY + 16 - ) { + if (mouseX > textFieldX && mouseX < textFieldX + textFieldWidth && mouseY > textFieldY && mouseY < textFieldY + 16) { textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton()); return true; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java index da39ca1..e2f96f9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorText.java @@ -26,8 +26,7 @@ public class GuiOptionEditorText extends GuiOptionEditor { int textFieldX = x + width / 6 - fullWidth / 2; if (textField.getFocus()) { - fullWidth = - Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10); + fullWidth = Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10); } textField.setSize(fullWidth, 16); @@ -44,20 +43,14 @@ public class GuiOptionEditorText extends GuiOptionEditor { int textFieldX = x + width / 6 - fullWidth / 2; if (textField.getFocus()) { - fullWidth = - Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10); + fullWidth = Math.max(fullWidth, Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10); } int textFieldY = y + height - 7 - 14; textField.setSize(fullWidth, 16); if (Mouse.getEventButtonState() && (Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1)) { - if ( - mouseX > textFieldX && - mouseX < textFieldX + fullWidth && - mouseY > textFieldY && - mouseY < textFieldY + 16 - ) { + if (mouseX > textFieldX && mouseX < textFieldX + fullWidth && mouseY > textFieldY && mouseY < textFieldY + 16) { textField.mouseClicked(mouseX, mouseY, Mouse.getEventButton()); return true; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java index e989b61..5b51f34 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/struct/ConfigProcessor.java @@ -106,9 +106,7 @@ public class ConfigProcessor { GuiOptionEditor editor = null; Class<?> optionType = optionField.getType(); if (optionField.isAnnotationPresent(ConfigEditorButton.class)) { - ConfigEditorButton configEditorAnnotation = optionField.getAnnotation( - ConfigEditorButton.class - ); + ConfigEditorButton configEditorAnnotation = optionField.getAnnotation(ConfigEditorButton.class); editor = new GuiOptionEditorButton( option, @@ -117,33 +115,17 @@ public class ConfigProcessor { config ); } - if ( - optionType.isAssignableFrom(boolean.class) && - optionField.isAnnotationPresent(ConfigEditorBoolean.class) - ) { + if (optionType.isAssignableFrom(boolean.class) && optionField.isAnnotationPresent(ConfigEditorBoolean.class)) { editor = new GuiOptionEditorBoolean(option); } - if ( - optionType.isAssignableFrom(boolean.class) && - optionField.isAnnotationPresent(ConfigEditorAccordion.class) - ) { - ConfigEditorAccordion configEditorAnnotation = optionField.getAnnotation( - ConfigEditorAccordion.class - ); + if (optionType.isAssignableFrom(boolean.class) && optionField.isAnnotationPresent(ConfigEditorAccordion.class)) { + ConfigEditorAccordion configEditorAnnotation = optionField.getAnnotation(ConfigEditorAccordion.class); editor = new GuiOptionEditorAccordion(option, configEditorAnnotation.id()); } if (optionType.isAssignableFrom(int.class)) { if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) { - ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation( - ConfigEditorDropdown.class - ); - editor = - new GuiOptionEditorDropdown( - option, - configEditorAnnotation.values(), - (int) option.get(), - true - ); + ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class); + editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), (int) option.get(), true); } } if (optionType.isAssignableFrom(List.class)) { @@ -156,9 +138,7 @@ public class ConfigProcessor { } if (optionType.isAssignableFrom(String.class)) { if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) { - ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation( - ConfigEditorDropdown.class - ); + ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class); editor = new GuiOptionEditorDropdown( option, @@ -178,9 +158,7 @@ public class ConfigProcessor { optionType.isAssignableFrom(double.class) ) { if (optionField.isAnnotationPresent(ConfigEditorSlider.class)) { - ConfigEditorSlider configEditorAnnotation = optionField.getAnnotation( - ConfigEditorSlider.class - ); + ConfigEditorSlider configEditorAnnotation = optionField.getAnnotation(ConfigEditorSlider.class); editor = new GuiOptionEditorSlider( option, @@ -192,9 +170,7 @@ public class ConfigProcessor { } if (optionType.isAssignableFrom(String.class)) { if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) { - ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation( - ConfigEditorDropdown.class - ); + ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class); editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), 0, false); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java index fd7d3b3..bc9a694 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java @@ -86,10 +86,7 @@ public class GuiElementSlider extends GuiElement { for (int i = 1; i < 4; i++) { int notchX = x + width * i / 4 - 1; - Minecraft - .getMinecraft() - .getTextureManager() - .bindTexture(notchX > x + sliderAmountI ? slider_off_notch : slider_on_notch); + Minecraft.getMinecraft().getTextureManager().bindTexture(notchX > x + sliderAmountI ? slider_off_notch : slider_on_notch); Utils.drawTexturedRect(notchX, y + (HEIGHT - 4) / 2f, 2, 4, GL11.GL_NEAREST); } @@ -104,8 +101,7 @@ public class GuiElementSlider extends GuiElement { } if (Mouse.getEventButton() == 0) { - clicked = - Mouse.getEventButtonState() && mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + HEIGHT; + clicked = Mouse.getEventButtonState() && mouseX > x && mouseX < x + width && mouseY > y && mouseY < y + HEIGHT; if (clicked) { value = (mouseX - x) * (maxValue - minValue) / width + minValue; value = Math.max(minValue, Math.min(maxValue, value)); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java index 5c59853..0ee34a1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/MiscUtils.java @@ -82,9 +82,7 @@ public class MiscUtils { } currentCursor = loc.getResourcePath(); try { - BufferedImage image = ImageIO.read( - Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream() - ); + BufferedImage image = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(loc).getInputStream()); int maxSize = Cursor.getMaxCursorSize(); IntBuffer buffer = BufferUtils.createIntBuffer(maxSize * maxSize); for (int i = 0; i < maxSize * maxSize; i++) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java index 518b928..963e1f7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java @@ -91,16 +91,7 @@ public class RenderUtils { drawTexturedRect(x, y, width, height, 0, 1, 0, 1, filter); } - public static void drawTexturedRect( - float x, - float y, - float width, - float height, - float uMin, - float uMax, - float vMin, - float vMax - ) { + public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax) { drawTexturedRect(x, y, width, height, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); } @@ -116,12 +107,7 @@ public class RenderUtils { int filter ) { GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate( - GL11.GL_SRC_ALPHA, - GL11.GL_ONE_MINUS_SRC_ALPHA, - GL11.GL_ONE, - GL11.GL_ONE_MINUS_SRC_ALPHA - ); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); drawTexturedRectNoBlend(x, y, width, height, uMin, uMax, vMin, vMax, filter); @@ -157,15 +143,7 @@ public class RenderUtils { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } - public static void drawGradientRect( - int zLevel, - int left, - int top, - int right, - int bottom, - int startColor, - int endColor - ) { + public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java index 478414e..f160c04 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java @@ -46,15 +46,7 @@ public class TextRenderUtils { } } - public static void drawStringScaledMaxWidth( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) { int strLen = fr.getStringWidth(str); float factor = len / (float) strLen; factor = Math.min(1, factor); @@ -73,15 +65,7 @@ public class TextRenderUtils { GL11.glTranslatef(-x2, -y2, 0); } - public static void drawStringScaled( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int colour, - float factor - ) { + public static void drawStringScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int colour, float factor) { GlStateManager.scale(factor, factor, 1); fr.drawString(str, x / factor, y / factor, colour, shadow); GlStateManager.scale(1 / factor, 1 / factor, 1); @@ -106,14 +90,7 @@ public class TextRenderUtils { drawStringScaled(str, fr, x - newLen / 2, y - fontHeight / 2, shadow, colour, factor); } - public static void renderToolTip( - ItemStack stack, - int mouseX, - int mouseY, - int screenWidth, - int screenHeight, - FontRenderer fontStd - ) { + public static void renderToolTip(ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontStd) { List<String> list = stack.getTooltip( Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips diff --git a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java index 4fd0fd4..aff9c1e 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java @@ -56,12 +56,7 @@ public class DungeonHandler { healthNum = Integer.parseInt(health); } catch (NumberFormatException ignored) {} } - DungeonPlayer player = new DungeonPlayer( - playerClass, - displayName, - healthNum, - health.equalsIgnoreCase("dead") - ); + DungeonPlayer player = new DungeonPlayer(playerClass, displayName, healthNum, health.equalsIgnoreCase("dead")); dungeonPlayersMap.put(displayName.toLowerCase(), player); } } @@ -82,12 +77,7 @@ public class DungeonHandler { public static void checkForDungeonCleared(String scoreline) { if (scoreline.toLowerCase().trim().contains("dungeon cleared:")) { - String dungeonClearedText = scoreline - .toLowerCase() - .trim() - .replace("dungeon cleared:", "") - .replace(" ", "") - .replace("%", ""); + String dungeonClearedText = scoreline.toLowerCase().trim().replace("dungeon cleared:", "").replace(" ", "").replace("%", ""); try { dungeonCleared = Integer.parseInt(dungeonClearedText); } catch (NumberFormatException ignored) {} @@ -96,12 +86,7 @@ public class DungeonHandler { public static void checkForDungeonKeys(String scoreline, String rawString) { if (scoreline.toLowerCase().trim().contains("keys:")) { - String dungeonClearedText = scoreline - .toLowerCase() - .trim() - .replace("keys:", "") - .replace(" ", "") - .replace("x", ""); + String dungeonClearedText = scoreline.toLowerCase().trim().replace("keys:", "").replace(" ", "").replace("x", ""); bloodKey = rawString.contains("\u2713"); try { witherKeys = Integer.parseInt(dungeonClearedText); @@ -130,9 +115,7 @@ public class DungeonHandler { public static void parseTotalSecrets(String playerName) { if (playerName.toLowerCase().contains("secrets found:")) { - String totalSecret = Utils - .removeColor(playerName.toLowerCase().replace("secrets found:", "")) - .replace(" ", ""); + String totalSecret = Utils.removeColor(playerName.toLowerCase().replace("secrets found:", "")).replace(" ", ""); try { totalSecrets = Integer.parseInt(totalSecret); } catch (NumberFormatException ignored) {} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java index fa0d21c..da27590 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/HeldItemHandler.java @@ -14,13 +14,7 @@ public class HeldItemHandler extends Gui { public void drawFuelBar(Minecraft mc, int current, int max) { GenericOverlays.drawSmallBar(mc, 100, 100, (double) current / (double) max, 1.0d, 0xff00ff, 0xffff00, 0); - drawString( - mc.fontRendererObj, - "Fuel - " + Math.round(((double) current / (double) max) * 100) + "%", - 100, - 100, - 0xffffff - ); + drawString(mc.fontRendererObj, "Fuel - " + Math.round(((double) current / (double) max) * 100) + "%", 100, 100, 0xffffff); } public boolean isDrill(ItemStack stack) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java index 5bc90d8..c8ef43b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java @@ -68,72 +68,12 @@ public class MapHandler { public enum Maps { HUB(0.5f, 494, 444, 294, 218, 294, 224, new ResourceLocation("skyblockhud", "maps/hub.png"), HubIcons.hubIcons), - MUSHROOM( - 1.0f, - 318, - 316, - -84, - 605, - -84, - 612, - new ResourceLocation("skyblockhud", "maps/mushroom.png"), - Collections.emptyList() - ), - SPIDERS( - 1.0f, - 270, - 238, - 400, - 362, - 400, - 364, - new ResourceLocation("skyblockhud", "maps/spidersden.png"), - Collections.emptyList() - ), - NETHER( - 0.5f, - 257, - 371, - 436, - 732, - 433, - 736, - new ResourceLocation("skyblockhud", "maps/fort.png"), - Collections.emptyList() - ), - BARN( - 1.5f, - 135, - 130, - -82, - 320, - -81, - 318, - new ResourceLocation("skyblockhud", "maps/barn.png"), - Collections.emptyList() - ), - DWARVEN( - 0.5f, - 409, - 461, - 206, - 160, - 202, - 166, - new ResourceLocation("skyblockhud", "maps/dwarven.png"), - DwarvenIcons.dwarvenIcons - ), - PARK( - 1.0f, - 211, - 230, - 480, - 133, - 478, - 134, - new ResourceLocation("skyblockhud", "maps/park.png"), - Collections.emptyList() - ); + MUSHROOM(1.0f, 318, 316, -84, 605, -84, 612, new ResourceLocation("skyblockhud", "maps/mushroom.png"), Collections.emptyList()), + SPIDERS(1.0f, 270, 238, 400, 362, 400, 364, new ResourceLocation("skyblockhud", "maps/spidersden.png"), Collections.emptyList()), + NETHER(0.5f, 257, 371, 436, 732, 433, 736, new ResourceLocation("skyblockhud", "maps/fort.png"), Collections.emptyList()), + BARN(1.5f, 135, 130, -82, 320, -81, 318, new ResourceLocation("skyblockhud", "maps/barn.png"), Collections.emptyList()), + DWARVEN(0.5f, 409, 461, 206, 160, 202, 166, new ResourceLocation("skyblockhud", "maps/dwarven.png"), DwarvenIcons.dwarvenIcons), + PARK(1.0f, 211, 230, 480, 133, 478, 134, new ResourceLocation("skyblockhud", "maps/park.png"), Collections.emptyList()); public float scaleFactor; public int width; @@ -170,13 +110,7 @@ public class MapHandler { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { - if ( - Utils.overlayShouldRender( - event.type, - SkyblockHud.hasSkyblockScoreboard(), - SkyblockHud.config.map.showMiniMap - ) - ) { + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.map.showMiniMap)) { Minecraft mc = Minecraft.getMinecraft(); if (mc.currentScreen instanceof MapScreen) return; if (LocationHandler.getCurrentLocation().getCategory().getMap() == null) return; @@ -298,12 +232,7 @@ public class MapHandler { if (this.mc.thePlayer != null && SkyblockHud.config.map.showPlayerLocation) { int x = this.mc.thePlayer.getPosition().getX() + map.xOffset; int z = this.mc.thePlayer.getPosition().getZ() + map.yOffset; - fontRendererObj.drawString( - "\u2022", - (int) (x * map.scaleFactor + mapX), - (int) (z * map.scaleFactor + mapY), - 0xff0000 - ); + fontRendererObj.drawString("\u2022", (int) (x * map.scaleFactor + mapX), (int) (z * map.scaleFactor + mapY), 0xff0000); } GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); onTooltip(mouseX, mouseY, (int) mapX, (int) mapY); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java index 627be26..b25733b 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java @@ -82,9 +82,7 @@ public class SlayerHandler { } SlayerHandler.currentSlayer = selectedSlayer; SlayerHandler.slayerTier = - Utils.whatRomanNumeral( - slayer.replace(selectedSlayer.getDisplayName().toLowerCase(), "").replace(" ", "") - ); + Utils.whatRomanNumeral(slayer.replace(selectedSlayer.getDisplayName().toLowerCase(), "").replace(" ", "")); break; } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java index 91b3835..f1aa222 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/TimeHandler.java @@ -17,12 +17,9 @@ public class TimeHandler { if (Pattern.matches("([0-9]*):([0-9]*)(pm|am)", event.formattedLine.toLowerCase().trim())) { boolean isPm = event.formattedLine.toLowerCase().trim().endsWith("pm"); SimpleDateFormat parseFormat = new SimpleDateFormat("hh:mm a", Locale.CANADA); - String currentTimeString = event.formattedLine - .replace(" ", "") - .replace(isPm ? "pm" : "am", isPm ? " pm" : " am"); + String currentTimeString = event.formattedLine.replace(" ", "").replace(isPm ? "pm" : "am", isPm ? " pm" : " am"); try { - time = - (parseFormat.parse(currentTimeString).getTime() - parseFormat.parse("00:00 am").getTime()) / 1000L; + time = (parseFormat.parse(currentTimeString).getTime() - parseFormat.parse("00:00 am").getTime()) / 1000L; } catch (ParseException ignored) { LogManager.getLogger().warn("timeformat error: " + currentTimeString); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java index eda0b6f..a59b0db 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java @@ -11,10 +11,7 @@ public class EntityTypeHelper { public static boolean isZealot(Entity entity) { if (entity instanceof EntityEnderman) { EntityEnderman enderman = ((EntityEnderman) entity); - double maxHealthBase = enderman - .getAttributeMap() - .getAttributeInstanceByName("generic.maxHealth") - .getBaseValue(); + double maxHealthBase = enderman.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); if ( maxHealthBase == 13000d || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame)) diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java index 7df5667..faec015 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java @@ -30,10 +30,7 @@ public class DwarvenMineHandler { public static int eventProgress; public static Event currentEvent; - private static final DecimalFormat formatter = new DecimalFormat( - "#,###", - DecimalFormatSymbols.getInstance(Locale.CANADA) - ); + private static final DecimalFormat formatter = new DecimalFormat("#,###", DecimalFormatSymbols.getInstance(Locale.CANADA)); public static String getMithrilFormatted() { String output = formatter.format(mithril); @@ -62,44 +59,25 @@ public class DwarvenMineHandler { } } if (DwarvenMineHandler.currentEvent != Event.NONE) { - if ( - DwarvenMineHandler.currentEvent == Event.TICKET && - event.formattedLine.toLowerCase().contains("tickets:") - ) { + if (DwarvenMineHandler.currentEvent == Event.TICKET && event.formattedLine.toLowerCase().contains("tickets:")) { if (event.formattedLine.toLowerCase().contains("pool:")) { try { - eventMax = - Integer.parseInt( - event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim() - ); + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("pool:", "").trim().split("/")[0].trim()); } catch (Exception ignored) {} } else if (event.formattedLine.toLowerCase().contains("tickets:")) { try { - eventProgress = - Integer.parseInt( - event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim() - ); + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("tickets:", "").split("\\(")[0].trim()); } catch (Exception ignored) {} } } else if (DwarvenMineHandler.currentEvent == Event.GOBLIN) { if (event.formattedLine.toLowerCase().contains("remaining:")) { try { eventMax = - Integer.parseInt( - event.formattedLine - .toLowerCase() - .replace("goblins", "") - .replace("remaining:", "") - .trim() - ); + Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); } catch (Exception ignored) {} - } else if ( - event.formattedLine.toLowerCase().contains("your kills:") && - !event.formattedLine.toLowerCase().contains("(") - ) { + } else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")) { try { - eventProgress = - Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim()); + eventProgress = Integer.parseInt(event.formattedLine.toLowerCase().replace("your kills:", "").trim()); } catch (Exception ignored) {} } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/EndIslandHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/EndIslandHandler.java index c989cb4..505db19 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/EndIslandHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/EndIslandHandler.java @@ -31,9 +31,7 @@ public class EndIslandHandler { public static dragonTypes findDragon(String input) { if (input.contains(" ")) { try { - return dragonTypes.valueOf( - input.toLowerCase().replace("dragon", "").replace(" ", "").toUpperCase() - ); + return dragonTypes.valueOf(input.toLowerCase().replace("dragon", "").replace(" ", "").toUpperCase()); } catch (IllegalArgumentException ignored) { return NODRAGON; } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java index 330b915..7363a45 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java @@ -15,15 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class MixinEndermanRenderer { @Inject(method = "doRender(Lnet/minecraft/entity/monster/EntityEnderman;DDDFF)V", at = @At("HEAD")) - public void onRender( - EntityEnderman entity, - double x, - double y, - double z, - float entityYaw, - float partialTicks, - CallbackInfo ci - ) { + public void onRender(EntityEnderman entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { if (EntityTypeHelper.isZealot(entity)) { Color color = new Color(SpecialColour.specialToChromaRGB("255:255:0:48:255")); GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 255f); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java index b4eb8db..462896d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java @@ -67,13 +67,7 @@ public class DungeonOverlay extends Gui { offset + (bossBarVisible ? 19 : 2), (DungeonHandler.hasBloodkey() ? 0x55FF55 : 0xAA0000) ); - drawString( - font, - DungeonHandler.getWitherKeys() + "x", - (width / 2), - offset + (bossBarVisible ? 30 : 13), - 0x555555 - ); + drawString(font, DungeonHandler.getWitherKeys() + "x", (width / 2), offset + (bossBarVisible ? 30 : 13), 0x555555); //CLEARED PERCENTAGE GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); @@ -83,14 +77,7 @@ public class DungeonOverlay extends Gui { (clearPercent <= 20 ? "4" : clearPercent <= 50 ? "6" : clearPercent <= 80 ? "e" : "a") + clearPercent + "%"; - drawTexturedModalRect( - (width / 2) + 17, - offset + (bossBarVisible ? 20 : 3), - 2, - 34, - font.getStringWidth(clearPercentage) + 3, - 14 - ); + drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(clearPercentage) + 3, 14); drawTexturedModalRect( ((width / 2) + 17) + font.getStringWidth(clearPercentage) + 3, offset + (bossBarVisible ? 20 : 3), @@ -106,22 +93,8 @@ public class DungeonOverlay extends Gui { mc.renderEngine.bindTexture(GuiTextures.overlay); int deaths = DungeonHandler.getDeaths(); String deathText = "Deaths: " + deaths; - drawTexturedModalRect( - (width / 2) + 17, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(deathText) + 3, - 14 - ); - drawTexturedModalRect( - ((width / 2) + 17) + font.getStringWidth(deathText) + 3, - offset + (bossBarVisible ? 35 : 18), - 252, - 34, - 4, - 14 - ); + drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(deathText) + 3, 14); + drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(deathText) + 3, offset + (bossBarVisible ? 35 : 18), 252, 34, 4, 14); drawString(font, deathText, (width / 2) + 18, offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); //SECRETS @@ -131,14 +104,7 @@ public class DungeonOverlay extends Gui { int secrets = DungeonHandler.getSecrets(); int totalSecrets = DungeonHandler.getTotalSecrets(); String secretsText = "Secrets: " + secrets + "/" + maxSecrets + " (" + totalSecrets + ")"; - drawTexturedModalRect( - (width / 2) - 17 - (font.getStringWidth(secretsText)) - 4, - offset + (bossBarVisible ? 20 : 3), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(secretsText)) - 4, offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 17 - (font.getStringWidth(secretsText))) - 2, offset + (bossBarVisible ? 20 : 3), @@ -147,27 +113,14 @@ public class DungeonOverlay extends Gui { font.getStringWidth(secretsText) + 2, 14 ); - drawString( - font, - secretsText, - (width / 2) - 17 - (font.getStringWidth(secretsText)), - offset + (bossBarVisible ? 23 : 6), - 0xAAAAAA - ); + drawString(font, secretsText, (width / 2) - 17 - (font.getStringWidth(secretsText)), offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); //CRYPTS GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); int crypts = DungeonHandler.getCrypts(); String cryptText = "Crypts: " + crypts; - drawTexturedModalRect( - (width / 2) - 17 - (font.getStringWidth(cryptText)) - 4, - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(cryptText)) - 4, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 17 - (font.getStringWidth(cryptText))) - 2, offset + (bossBarVisible ? 35 : 18), @@ -176,13 +129,7 @@ public class DungeonOverlay extends Gui { font.getStringWidth(cryptText) + 2, 14 ); - drawString( - font, - cryptText, - (width / 2) - 17 - (font.getStringWidth(cryptText)), - offset + (bossBarVisible ? 38 : 21), - 0xAAAAAA - ); + drawString(font, cryptText, (width / 2) - 17 - (font.getStringWidth(cryptText)), offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); } public void drawUltimateBar(Minecraft mc, ScaledResolution resolution) { @@ -217,8 +164,7 @@ public class DungeonOverlay extends Gui { LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS) ) ) { - bossBarVisible = - BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; + bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; GlStateManager.enableBlend(); drawUltimateBar(mc, event.resolution); @@ -245,21 +191,10 @@ public class DungeonOverlay extends Gui { } catch (ArrayIndexOutOfBoundsException ignored) { posY = 0; } - drawDungeonPlayer( - player.getName(), - player.getHealth(), - player.isDead(), - player.getDungeonClass(), - posX, - posY - ); + drawDungeonPlayer(player.getName(), player.getHealth(), player.isDead(), player.getDungeonClass(), posX, posY); } } - drawDungeonClock( - event.resolution.getScaledWidth(), - SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), - mc - ); + drawDungeonClock(event.resolution.getScaledWidth(), SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); } } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java index b249362..439d857 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java @@ -25,12 +25,7 @@ public class GenericOverlays extends Gui { Color color = new Color(percentage == max ? fullColor : loadingColor); RenderUtils.drawTexturedModalRect(x, y, 0, 0, 182, 5); - GlStateManager.color( - color.getRed() / 255f, - color.getGreen() / 255f, - color.getBlue() / 255f, - color.getAlpha() / 255f - ); + GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); RenderUtils.drawTexturedModalRect(x, y, 0, 30, 182, 5); RenderUtils.drawTexturedModalRect(x, y, 0, 5, (int) (182 * percentage), 5); if (barStyle != 0) { @@ -54,12 +49,7 @@ public class GenericOverlays extends Gui { Color color = new Color(percentage == max ? fullColor : loadingColor); GlStateManager.enableBlend(); RenderUtils.drawTexturedModalRect(x, y, 0, 35, 62, 5); - GlStateManager.color( - color.getRed() / 255f, - color.getGreen() / 255f, - color.getBlue() / 255f, - color.getAlpha() / 255f - ); + GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); RenderUtils.drawTexturedModalRect(x, y, 0, 65, 62, 5); RenderUtils.drawTexturedModalRect(x, y, 0, 40, (int) (62 * percentage), 5); if (barStyle != 0) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index 5560ff7..530a890 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -43,20 +43,10 @@ public class OverlayHud extends Gui { String militaryTime = timeHour + ":" + (timeMin == 0 ? timeMin + "0" : timeMin); int time12Hour = timeHour >= 12 ? timeHour - 12 : timeHour; String normalTime = - (time12Hour == 0 ? "00" : String.valueOf(time12Hour)) + - ":" + - (timeMin == 0 ? "00" : timeMin) + - (timeHour >= 12 ? "pm" : "am"); + (time12Hour == 0 ? "00" : String.valueOf(time12Hour)) + ":" + (timeMin == 0 ? "00" : timeMin) + (timeHour >= 12 ? "pm" : "am"); drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); - drawTexturedModalRect( - (width / 2) - 4, - offset + (bossBarVisible ? 24 : 7), - (timeHour > 19 || timeHour < 4) ? 43 : 43 + 8, - 0, - 8, - 8 - ); + drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 24 : 7), (timeHour > 19 || timeHour < 4) ? 43 : 43 + 8, 0, 8, 8); if (SkyblockHud.config.main.twelveHourClock) drawScaledString( 0.8f, width / 2, @@ -94,10 +84,7 @@ public class OverlayHud extends Gui { } else { drawMithril(width, offset, mc); } - } else if ( - LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK) && - ParkIslandHandler.isRaining() - ) { + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK) && ParkIslandHandler.isRaining()) { if (LocationHandler.getCurrentLocation().equals(Locations.HOWLINGCAVE)) { drawSlayer(width, offset, mc); } else drawRainDuration(width, offset, mc); @@ -114,19 +101,9 @@ public class OverlayHud extends Gui { mc.renderEngine.bindTexture(GuiTextures.overlay); String dateText = SeasonDateHandler.getFancySeasonAndDate(); if ( - eventToggle && - !SeasonDateHandler.getCurrentEvent().isEmpty() && - !SeasonDateHandler.getCurrentEventTime().isEmpty() - ) dateText = - SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); - drawTexturedModalRect( - (width / 2) + 17, - offset + (bossBarVisible ? 20 : 3), - 2, - 34, - font.getStringWidth(dateText) + 9, - 14 - ); + eventToggle && !SeasonDateHandler.getCurrentEvent().isEmpty() && !SeasonDateHandler.getCurrentEventTime().isEmpty() + ) dateText = SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); + drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(dateText) + 9, 14); drawTexturedModalRect( ((width / 2) + 17) + font.getStringWidth(dateText) + 9, offset + (bossBarVisible ? 20 : 3), @@ -233,13 +210,7 @@ public class OverlayHud extends Gui { 14 ); drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 75, 0, 8, 8); - drawString( - font, - CurrencyHandler.getBitsFormatted(), - xPos + 10, - offset + (bossBarVisible ? 38 : 21), - 0x55FFFF - ); + drawString(font, CurrencyHandler.getBitsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0x55FFFF); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); xPos += font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11; @@ -262,14 +233,7 @@ public class OverlayHud extends Gui { ) duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "day"; else duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "days"; mc.renderEngine.bindTexture(GuiTextures.overlay); - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -286,13 +250,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - duration, - (width / 2) - 19 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -301,14 +259,7 @@ public class OverlayHud extends Gui { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); String duration = "Rain: " + ParkIslandHandler.getRainTime(); - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -325,13 +276,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - duration, - (width / 2) - 19 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -366,14 +311,7 @@ public class OverlayHud extends Gui { stringBuilder.append(maxKills); } String text = stringBuilder.toString(); - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(text)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -390,13 +328,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - text, - (width / 2) - 19 - (font.getStringWidth(text)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } } @@ -406,14 +338,7 @@ public class OverlayHud extends Gui { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); String mithril = DwarvenMineHandler.getMithrilFormatted(); - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(mithril)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -430,13 +355,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - mithril, - (width / 2) - 19 - (font.getStringWidth(mithril)), - offset + (bossBarVisible ? 38 : 21), - 0x00C896 - ); + drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); } } @@ -447,14 +366,7 @@ public class OverlayHud extends Gui { String duration = FarmingIslandHandler.location != Locations.NONE ? FarmingIslandHandler.location.getDisplayName() : "" + FarmingIslandHandler.pelts; - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -471,13 +383,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - duration, - (width / 2) - 19 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -520,14 +426,7 @@ public class OverlayHud extends Gui { ); } else { String text = DwarvenMineHandler.currentEvent.displayName; - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(text)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); drawTexturedModalRect( ((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), @@ -544,13 +443,7 @@ public class OverlayHud extends Gui { 8, 8 ); - drawString( - font, - text, - (width / 2) - 19 - (font.getStringWidth(text)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } } @@ -558,16 +451,11 @@ public class OverlayHud extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard())) { - bossBarVisible = - BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; + bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; Minecraft mc = Minecraft.getMinecraft(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (LocationHandler.getCurrentLocation() != Locations.CATACOMBS) { - drawClock( - event.resolution.getScaledWidth(), - SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), - mc - ); + drawClock(event.resolution.getScaledWidth(), SkyblockHud.config.main.mainHudPos.getAbsY(event.resolution, 34), mc); } GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index dce51a9..7c622e4 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -53,24 +53,14 @@ public class RPGHud extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { if ( - Utils.overlayShouldRender( - event.type, - SkyblockHud.hasSkyblockScoreboard(), - SkyblockHud.config.renderer.hideXpBar - ) + Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.renderer.hideXpBar) ) MinecraftForge.EVENT_BUS.post( new RenderGameOverlayEvent.Post( new RenderGameOverlayEvent(event.partialTicks, event.resolution), RenderGameOverlayEvent.ElementType.EXPERIENCE ) ); - if ( - Utils.overlayShouldRender( - event.type, - SkyblockHud.hasSkyblockScoreboard(), - SkyblockHud.config.rpg.showRpgHud - ) - ) { + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.rpg.showRpgHud)) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.enableBlend(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); @@ -90,35 +80,14 @@ public class RPGHud extends Gui { drawTexturedModalRect(x, y, rightAligned ? 131 : 5, 6, 120, 47); float manaWidth = Math.min(57 * ((float) mana / (float) maxMana), 57); - drawTexturedModalRect( - rightAligned ? x + 16 : 47 + x, - 17 + y, - rightAligned ? 199 : 0, - 64, - (int) manaWidth, - 4 - ); + drawTexturedModalRect(rightAligned ? x + 16 : 47 + x, 17 + y, rightAligned ? 199 : 0, 64, (int) manaWidth, 4); float healthWidth = Math.min(70 * ((float) health / (float) maxHealth), 70); - drawTexturedModalRect( - rightAligned ? x + 3 : 47 + x, - 22 + y, - rightAligned ? 186 : 0, - 68, - (int) healthWidth, - 5 - ); + drawTexturedModalRect(rightAligned ? x + 3 : 47 + x, 22 + y, rightAligned ? 186 : 0, 68, (int) healthWidth, 5); if (health > maxHealth) { float absorptionWidth = Math.min(70 * ((float) (health - maxHealth) / (float) maxHealth), 70); - drawTexturedModalRect( - rightAligned ? x + 3 : 47 + x, - 22 + y, - rightAligned ? 186 : 0, - 77, - (int) absorptionWidth, - 5 - ); + drawTexturedModalRect(rightAligned ? x + 3 : 47 + x, 22 + y, rightAligned ? 186 : 0, 77, (int) absorptionWidth, 5); } float xpWidth = 67 * mc.thePlayer.experience; @@ -129,14 +98,7 @@ public class RPGHud extends Gui { if (mc.thePlayer.getAir() < 300) { float airWidth = 60 * ((float) mc.thePlayer.getAir() / 300); drawTexturedModalRect(rightAligned ? x + 17 : 39 + x, 33 + y, rightAligned ? 192 : 0, 82, 64, 6); - drawTexturedModalRect( - rightAligned ? x + 19 : 41 + x, - 33 + y, - rightAligned ? 196 : 0, - 88, - (int) airWidth, - 4 - ); + drawTexturedModalRect(rightAligned ? x + 19 : 41 + x, 33 + y, rightAligned ? 196 : 0, 88, (int) airWidth, 4); } GlStateManager.scale(0.75f, 0.75f, 1); drawCenteredString( diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index 44a250f..1fc9a77 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -29,15 +29,11 @@ public class ActionBarParsing { ); private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764"); - private static final Pattern HealingReplaceRegex = Pattern.compile( - "\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]" - ); + private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76([0-9]+)/([0-9]+)\u2764"); private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a([0-9]+)\u00A7a\u2748 Defense"); private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E Mana"); - private static final Pattern ManaOverflowReplaceRegex = Pattern.compile( - "\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC" - ); + private static final Pattern ManaOverflowReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC"); private static int ticksSinceLastPrediction = 0; private static boolean predict = false; @@ -99,10 +95,7 @@ public class ActionBarParsing { if (healthFound) { try { - RPGHud.updateHealth( - Integer.parseInt(HealthMatcher.group(1)), - Integer.parseInt(HealthMatcher.group(2)) - ); + RPGHud.updateHealth(Integer.parseInt(HealthMatcher.group(1)), Integer.parseInt(HealthMatcher.group(2))); } catch (Exception ignored) {} } if (defenseFound) { @@ -119,10 +112,7 @@ public class ActionBarParsing { } if (!manaFound && manaOverflowFound) { try { - RPGHud.updateMana( - Integer.parseInt(ManaOverflowMatcher.group(1)), - Integer.parseInt(ManaOverflowMatcher.group(2)) - ); + RPGHud.updateMana(Integer.parseInt(ManaOverflowMatcher.group(1)), Integer.parseInt(ManaOverflowMatcher.group(2))); RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3))); } catch (Exception ignored) {} } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java index ef61b43..b794eda 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java @@ -67,12 +67,7 @@ public class SeasonDateHandler { } public static String removeDate(String seasonDate) { - return Pattern - .compile("[^a-zA-Z]") - .matcher(seasonDate.toLowerCase()) - .replaceAll("") - .replaceAll("st|nd|rd|th", "") - .trim(); + return Pattern.compile("[^a-zA-Z]").matcher(seasonDate.toLowerCase()).replaceAll("").replaceAll("st|nd|rd|th", "").trim(); } public static int removeSeason(String seasonDate) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java index ba22101..858770a 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java @@ -28,10 +28,7 @@ public class TrackerFileLoader { if (jsonObject.has("skullData") && displayItemId.equals("minecraft:skull") && meta == 3) { stack.setTagInfo("SkullOwner", getSkullTag(jsonObject.getAsJsonObject("skullData"))); } - if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) stack.setTagInfo( - "ench", - new NBTTagList() - ); + if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) stack.setTagInfo("ench", new NBTTagList()); return stack; } @@ -97,10 +94,7 @@ public class TrackerFileLoader { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("location", locations); - if (event == null) jsonObject.add("event", new JsonNull()); else jsonObject.addProperty( - "event", - event - ); + if (event == null) jsonObject.add("event", new JsonNull()); else jsonObject.addProperty("event", event); JsonObject dropsData = new JsonObject(); drops.forEach((s, stack) -> dropsData.addProperty(s, stack.stackSize)); @@ -134,9 +128,7 @@ public class TrackerFileLoader { } try ( - BufferedReader reader = new BufferedReader( - new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) ) { JsonObject json = gson.fromJson(reader, JsonObject.class); if (json.has("trackerStats")) { @@ -147,19 +139,14 @@ public class TrackerFileLoader { if (element.isJsonObject()) { JsonObject object = element.getAsJsonObject(); String location = object.get("location").getAsString(); - Map<String, Map<String, ItemStack>> trackers = TrackerHandler.trackers.get(location) - .dropTrackers; + Map<String, Map<String, ItemStack>> trackers = TrackerHandler.trackers.get(location).dropTrackers; JsonElement event = object.get("event"); - String eventString = event == null || event.isJsonNull() - ? null - : event.getAsString(); + String eventString = event == null || event.isJsonNull() ? null : event.getAsString(); Map<String, ItemStack> drops = trackers.get(eventString); if (drops != null) { - for (Map.Entry<String, JsonElement> drop : object - .getAsJsonObject("drops") - .entrySet()) { + for (Map.Entry<String, JsonElement> drop : object.getAsJsonObject("drops").entrySet()) { if (drops.containsKey(drop.getKey())) { drops.get(drop.getKey()).stackSize = drop.getValue().getAsInt(); } @@ -183,9 +170,7 @@ public class TrackerFileLoader { configFile.createNewFile(); try ( - BufferedWriter writer = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) ) { JsonObject json = new JsonObject(); json.add("trackerStats", getTrackerFile()); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index 2d5607f..f0a5b90 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -27,12 +27,7 @@ public class TrackerHandler { } public String getDropId(String event) { - if ( - event == null || - event.isEmpty() || - !eventGoing() || - !dropTrackers.containsKey(event.toLowerCase().trim()) - ) return null; + if (event == null || event.isEmpty() || !eventGoing() || !dropTrackers.containsKey(event.toLowerCase().trim())) return null; return event.toLowerCase().trim(); } @@ -99,9 +94,7 @@ public class TrackerHandler { Minecraft mc = Minecraft.getMinecraft(); TrackerData tracked = trackers.get(trackerId); - Map<String, ItemStack> tracker = tracked.dropTrackers.get( - tracked.getDropId(SeasonDateHandler.getCurrentEvent()) - ); + Map<String, ItemStack> tracker = tracked.dropTrackers.get(tracked.getDropId(SeasonDateHandler.getCurrentEvent())); if (tracker != null) { Position pos = SkyblockHud.config.trackers.trackerPosition; int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 120 : tracker.size() * 20)); |