From 98ee5a2ae8090c061b1e61e7955d793416991822 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:24:20 -0400 Subject: 140? --- .../skyblockhud/ComponentHandler.java | 47 ++----- .../com/thatgravyboat/skyblockhud/GuiTextures.java | 28 +--- .../com/thatgravyboat/skyblockhud/SkyblockHud.java | 21 +-- .../java/com/thatgravyboat/skyblockhud/Utils.java | 66 ++------- .../skyblockhud/api/LeaderboardGetter.java | 9 +- .../skyblockhud/config/SBHConfig.java | 14 +- .../skyblockhud/config/SBHConfigEditor.java | 75 +++------- .../skyblockhud/core/GuiElementBoolean.java | 7 +- .../skyblockhud/core/GuiElementColour.java | 64 ++------- .../skyblockhud/core/GuiElementTextField.java | 42 ++---- .../core/config/gui/GuiOptionEditor.java | 10 +- .../core/config/gui/GuiOptionEditorButton.java | 14 +- .../config/gui/GuiOptionEditorDraggableList.java | 24 +--- .../core/config/gui/GuiOptionEditorDropdown.java | 61 ++------ .../core/config/gui/GuiOptionEditorSlider.java | 18 +-- .../core/config/gui/GuiOptionEditorText.java | 13 +- .../core/config/struct/ConfigProcessor.java | 42 ++---- .../skyblockhud/core/util/GuiElementSlider.java | 8 +- .../skyblockhud/core/util/MiscUtils.java | 4 +- .../skyblockhud/core/util/render/RenderUtils.java | 28 +--- .../core/util/render/TextRenderUtils.java | 29 +--- .../skyblockhud/dungeons/DungeonHandler.java | 25 +--- .../skyblockhud/handlers/HeldItemHandler.java | 8 +- .../skyblockhud/handlers/MapHandler.java | 87 ++---------- .../skyblockhud/handlers/SlayerHandler.java | 4 +- .../skyblockhud/handlers/TimeHandler.java | 7 +- .../handlers/sbentities/EntityTypeHelper.java | 5 +- .../skyblockhud/location/DwarvenMineHandler.java | 36 +---- .../skyblockhud/location/EndIslandHandler.java | 4 +- .../skyblockhud/mixins/MixinEndermanRenderer.java | 10 +- .../skyblockhud/overlay/DungeonOverlay.java | 87 ++---------- .../skyblockhud/overlay/GenericOverlays.java | 14 +- .../skyblockhud/overlay/OverlayHud.java | 154 +++------------------ .../thatgravyboat/skyblockhud/overlay/RPGHud.java | 50 +------ .../skyblockhud/playerstats/ActionBarParsing.java | 18 +-- .../skyblockhud/seasons/SeasonDateHandler.java | 7 +- .../skyblockhud/tracker/TrackerFileLoader.java | 29 +--- .../skyblockhud/tracker/TrackerHandler.java | 11 +- 38 files changed, 200 insertions(+), 980 deletions(-) (limited to 'src/main/java') 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 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 SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet( - "SKYBLOCK", - "\u7A7A\u5C9B\u751F\u5B58" - ); + private static final Set 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 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 scoreList = sidebarObjective.getScoreboard().getSortedScores(sidebarObjective); - Map scores = scoreList - .stream() - .collect(Collectors.toMap(Score::getScorePoints, this::getLine)); + Map 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 getOptionsInCategory( - ConfigProcessor.ProcessedCategory cat - ) { + private LinkedHashMap 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 entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry 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 entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry 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 colourChangedCallback, - Runnable closeCallback - ) { + public GuiElementColour(int x, int y, String initialColour, Consumer 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 = ""; } - 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( -