From 804767ebfc26e2a1252bc327def02389b35dfc6e Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 6 Jul 2021 17:27:11 -0400 Subject: fine --- .../skyblockhud/ComponentHandler.java | 48 +--- .../com/thatgravyboat/skyblockhud/SkyblockHud.java | 8 +- .../java/com/thatgravyboat/skyblockhud/Utils.java | 49 +--- .../skyblockhud/api/LeaderboardGetter.java | 18 +- .../api/events/SidebarLineUpdateEvent.java | 9 +- .../skyblockhud/commands/Commands.java | 6 +- .../skyblockhud/config/SBHConfig.java | 33 +-- .../skyblockhud/config/SBHConfigEditor.java | 130 ++------- .../skyblockhud/core/BackgroundBlur.java | 29 +- .../skyblockhud/core/GuiElementColour.java | 87 +----- .../skyblockhud/core/GuiElementTextField.java | 108 +------ .../core/config/gui/GuiOptionEditorAccordion.java | 10 +- .../core/config/gui/GuiOptionEditorButton.java | 10 +- .../core/config/gui/GuiOptionEditorColour.java | 9 +- .../config/gui/GuiOptionEditorDraggableList.java | 78 +----- .../core/config/gui/GuiOptionEditorSlider.java | 6 +- .../core/config/gui/GuiPositionEditor.java | 27 +- .../core/config/struct/ConfigProcessor.java | 42 +-- .../skyblockhud/core/util/GuiElementSlider.java | 11 +- .../skyblockhud/core/util/render/RenderUtils.java | 35 +-- .../core/util/render/TextRenderUtils.java | 115 +------- .../skyblockhud/dungeons/DungeonHandler.java | 6 +- .../skyblockhud/handlers/BossbarHandler.java | 6 +- .../skyblockhud/handlers/CurrencyHandler.java | 21 +- .../skyblockhud/handlers/MapHandler.java | 122 +------- .../skyblockhud/handlers/SlayerHandler.java | 17 +- .../handlers/mapicons/DwarvenIcons.java | 67 +---- .../skyblockhud/handlers/mapicons/HubIcons.java | 309 ++------------------- .../handlers/sbentities/EntityTypeHelper.java | 5 +- .../handlers/sbentities/EntityTypeRegistry.java | 4 +- .../skyblockhud/location/DwarvenMineHandler.java | 3 +- .../skyblockhud/location/IslandHandler.java | 10 +- .../skyblockhud/mixins/MixinEntityArrow.java | 7 +- .../mixins/MixinNetHandlerPlayClient.java | 12 +- .../skyblockhud/overlay/DungeonOverlay.java | 72 +---- .../skyblockhud/overlay/GenericOverlays.java | 22 +- .../skyblockhud/overlay/OverlayHud.java | 260 +++-------------- .../thatgravyboat/skyblockhud/overlay/RPGHud.java | 25 +- .../skyblockhud/playerstats/ActionBarParsing.java | 4 +- .../skyblockhud/seasons/SeasonDateHandler.java | 5 +- .../skyblockhud/tracker/KillTrackerHandler.java | 32 +-- .../skyblockhud/tracker/TrackerFileLoader.java | 13 +- .../skyblockhud/tracker/TrackerHandler.java | 24 +- 43 files changed, 220 insertions(+), 1694 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 ad7b1e8..d56fd30 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -38,19 +38,11 @@ public class ComponentHandler { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { if (player.getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS - .matcher(Utils.removeColor(player.getDisplayName().getFormattedText())) - .replaceAll(""); + String formattedTabListPlayer = SCOREBOARD_CHARACTERS.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 - ); + 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); @@ -58,8 +50,7 @@ public class ComponentHandler { } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { - FarmingIslandHandler.pelts = - Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); + FarmingIslandHandler.pelts = Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); } catch (Exception ignored) {} } } @@ -68,15 +59,11 @@ public class ComponentHandler { if (players.size() > 80) { for (int i = 61; i <= 80; i++) { if (players.get(i).getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS - .matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())) - .replaceAll(""); + String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); if (formattedTabListPlayer.toLowerCase().contains("event:")) { if (i < 80) { if (players.get(i + 1).getDisplayName() != null) { - String secondLine = SCOREBOARD_CHARACTERS - .matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())) - .replaceAll(""); + String secondLine = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())).replaceAll(""); SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); eventPass = true; } @@ -93,9 +80,7 @@ public class ComponentHandler { if (players.size() >= 80) { for (int i = 41; i <= 60; i++) { if (players.get(i).getDisplayName() != null) { - String formattedTabListPlayer = SCOREBOARD_CHARACTERS - .matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())) - .replaceAll(""); + String formattedTabListPlayer = SCOREBOARD_CHARACTERS.matcher(Utils.removeColor(players.get(i).getDisplayName().getFormattedText())).replaceAll(""); if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.PARK)) { if (formattedTabListPlayer.toLowerCase().contains("rain:")) { ParkIslandHandler.parseRain(formattedTabListPlayer.toLowerCase()); @@ -114,9 +99,7 @@ public class ComponentHandler { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBar(ClientChatReceivedEvent event) { if (event.type == 2) { - if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets( - event.message.getFormattedText() - ); + if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) DungeonHandler.parseSecrets(event.message.getFormattedText()); } } @@ -128,18 +111,7 @@ public class ComponentHandler { public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) { ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); - return ComparisonChain - .start() - .compareTrueFirst( - p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, - p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR - ) - .compare( - scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", - scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "" - ) - .compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()) - .result(); + return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); } } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 071d120..f461f6d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -86,9 +86,7 @@ public class SkyblockHud { configFile = new File(event.getModConfigurationDirectory(), "sbh-config.json"); if (configFile.exists()) { - try ( - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) - ) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) { config = gson.fromJson(reader, SBHConfig.class); } catch (Exception ignored) {} } @@ -108,9 +106,7 @@ public class SkyblockHud { try { configFile.createNewFile(); - try ( - BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) - ) { + try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) { writer.write(gson.toJson(config)); } } catch (IOException ignored) {} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java index 56b5f56..a7621ef 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java @@ -38,9 +38,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")) - ); + ArrayList redstoneItems = new ArrayList<>(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; } @@ -107,12 +105,7 @@ public class Utils { return overlayShouldRender(false, type, RenderGameOverlayEvent.ElementType.HOTBAR, booleans); } - public static boolean overlayShouldRender( - boolean hideOnf3, - RenderGameOverlayEvent.ElementType type, - RenderGameOverlayEvent.ElementType checkType, - boolean... booleans - ) { + public static boolean overlayShouldRender(boolean hideOnf3, RenderGameOverlayEvent.ElementType type, RenderGameOverlayEvent.ElementType checkType, boolean... booleans) { Minecraft mc = Minecraft.getMinecraft(); boolean shouldRender; if (booleans.length > 1) { @@ -120,13 +113,7 @@ public class Utils { shouldRender = true; } else shouldRender = booleans.length != 1 || booleans[0]; if (hideOnf3) { - if ( - mc.gameSettings.showDebugInfo || - ( - mc.gameSettings.keyBindPlayerList.isKeyDown() && - (!mc.isIntegratedServerRunning() || mc.thePlayer.sendQueue.getPlayerInfoMap().size() > 1) - ) - ) { + if (mc.gameSettings.showDebugInfo || (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || mc.thePlayer.sendQueue.getPlayerInfoMap().size() > 1))) { return false; } } @@ -155,17 +142,7 @@ public class Utils { drawStringScaled(str, fr, x - len / 2f, y - fontHeight / 2f, shadow, colour, factor); } - public static void drawTexturedRect( - float x, - float y, - float width, - float height, - float uMin, - float uMax, - float vMin, - float vMax, - int filter - ) { + public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) { 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); @@ -240,14 +217,7 @@ public class Utils { GlStateManager.viewport(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); - GlStateManager.ortho( - 0.0D, - scaledresolution.getScaledWidth_double(), - scaledresolution.getScaledHeight_double(), - 0.0D, - 1000.0D, - 3000.0D - ); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -2000.0F); @@ -260,14 +230,7 @@ public class Utils { } else { GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); - GlStateManager.ortho( - 0.0D, - scaledresolution.getScaledWidth_double(), - scaledresolution.getScaledHeight_double(), - 0.0D, - 1000.0D, - 3000.0D - ); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -2000.0F); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java index db9ad38..b1115ae 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java @@ -43,26 +43,12 @@ public class LeaderboardGetter { scores.forEach( (score, name) -> { if (cachedScores.get(score) == null || !cachedScores.get(score).equals(name)) { - MinecraftForge.EVENT_BUS.post( - new SidebarLineUpdateEvent( - name, - SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim(), - score, - scores.size(), - scoreboard, - sidebarObjective - ) - ); + MinecraftForge.EVENT_BUS.post(new SidebarLineUpdateEvent(name, SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim(), score, scores.size(), scoreboard, sidebarObjective)); } } ); cachedScores = scores; - cachedScoresList = - scores - .values() - .stream() - .map(name -> SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim()) - .collect(Collectors.toList()); + cachedScoresList = scores.values().stream().map(name -> SCOREBOARD_CHARACTERS.matcher(name).replaceAll("").trim()).collect(Collectors.toList()); } MinecraftForge.EVENT_BUS.post(new SidebarPostEvent(scoreboard, sidebarObjective, cachedScoresList)); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java index 8a7aa39..2737ee9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/events/SidebarLineUpdateEvent.java @@ -12,14 +12,7 @@ public class SidebarLineUpdateEvent extends Event { public Scoreboard scoreboard; public ScoreObjective objective; - public SidebarLineUpdateEvent( - String rawLine, - String formattedLine, - int score, - int max, - Scoreboard scoreboard, - ScoreObjective objective - ) { + public SidebarLineUpdateEvent(String rawLine, String formattedLine, int score, int max, Scoreboard scoreboard, ScoreObjective objective) { this.rawLine = rawLine; this.formattedLine = formattedLine; this.position = max - score; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java index 8304906..ef3df57 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/commands/Commands.java @@ -15,8 +15,7 @@ public class Commands { private static final SimpleCommand.ProcessCommandRunnable settingsRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { if (args.length > 0) { - SkyblockHud.screenToOpen = - new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, StringUtils.join(args, " "))); + SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, StringUtils.join(args, " "))); } else { SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config)); } @@ -31,8 +30,7 @@ public class Commands { "sbhmap", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if (LocationHandler.getCurrentLocation().getCategory().getMap() != null) SkyblockHud.screenToOpen = - new MapHandler.MapScreen(); + if (LocationHandler.getCurrentLocation().getCategory().getMap() != null) SkyblockHud.screenToOpen = new MapHandler.MapScreen(); } } ); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index c8f6d53..90f4c19 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -12,18 +12,7 @@ import net.minecraft.client.Minecraft; public class SBHConfig extends Config { private void editOverlay(String activeConfig, int width, int height, Position position) { - Minecraft - .getMinecraft() - .displayGuiScreen( - new GuiPositionEditor( - position, - width, - height, - () -> {}, - () -> {}, - () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) - ) - ); + Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(position, width, height, () -> {}, () -> {}, () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)))); } @Override @@ -121,10 +110,7 @@ public class SBHConfig extends Config { public boolean bossShiftHud = true; @Expose - @ConfigOption( - name = "Require Redstone", - desc = "Allows to make it so that the redstone percentage requires you to hold a redstone item to show." - ) + @ConfigOption(name = "Require Redstone", desc = "Allows to make it so that the redstone percentage requires you to hold a redstone item to show.") @ConfigEditorBoolean public boolean requireRedstone = true; } @@ -230,10 +216,7 @@ public class SBHConfig extends Config { public static class Renderer { @Expose - @ConfigOption( - name = "Hide Boss Bar", - desc = "Hides Boss Bar when certain conditions are met such as the name is just wither or it starts with objective:" - ) + @ConfigOption(name = "Hide Boss Bar", desc = "Hides Boss Bar when certain conditions are met such as the name is just wither or it starts with objective:") @ConfigEditorBoolean public boolean hideBossBar = true; @@ -271,18 +254,12 @@ public class SBHConfig extends Config { public static class Map { @Expose - @ConfigOption( - name = "Show Player Location", - desc = "This feature is off by default as Hypixel's rules are so vague that this would fall under their disallowed modifications." - ) + @ConfigOption(name = "Show Player Location", desc = "This feature is off by default as Hypixel's rules are so vague that this would fall under their disallowed modifications.") @ConfigEditorBoolean public boolean showPlayerLocation = false; @Expose - @ConfigOption( - name = "Show Mini-Map", - desc = "Shows the Mini-Map on your overlay if turned off you can still use /sbhmap to see the map in fullscreen." - ) + @ConfigOption(name = "Show Mini-Map", desc = "Shows the Mini-Map on your overlay if turned off you can still use /sbhmap to see the map in fullscreen.") @ConfigEditorBoolean public boolean showMiniMap = false; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 7dee8e6..0496a8f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -119,15 +119,7 @@ public class SBHConfigEditor extends GuiElement { int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; float opacityFactor = LerpUtils.sigmoidZeroOne(delta / 500f); - RenderUtils.drawGradientRect( - 0, - 0, - 0, - width, - height, - (int) (0x80 * opacityFactor) << 24 | 0x101010, - (int) (0x90 * opacityFactor) << 24 | 0x101010 - ); + RenderUtils.drawGradientRect(0, 0, 0, width, height, (int) (0x80 * opacityFactor) << 24 | 0x101010, (int) (0x90 * opacityFactor) << 24 | 0x101010); int xSize = Math.min(scaledResolution.getScaledWidth() - 100 / scaledResolution.getScaleFactor(), 500); int ySize = Math.min(scaledResolution.getScaledHeight() - 100 / scaledResolution.getScaleFactor(), 400); @@ -145,39 +137,14 @@ public class SBHConfigEditor extends GuiElement { } else if (delta < 300) { openingYSize = 5 + (int) (delta - 150) * (ySize - 5) / 150; } - RenderUtils.drawFloatingRectDark( - (scaledResolution.getScaledWidth() - openingXSize) / 2, - (scaledResolution.getScaledHeight() - openingYSize) / 2, - openingXSize, - openingYSize - ); + RenderUtils.drawFloatingRectDark((scaledResolution.getScaledWidth() - openingXSize) / 2, (scaledResolution.getScaledHeight() - openingYSize) / 2, openingXSize, openingYSize); GlScissorStack.clear(); - GlScissorStack.push( - (scaledResolution.getScaledWidth() - openingXSize) / 2, - (scaledResolution.getScaledHeight() - openingYSize) / 2, - (scaledResolution.getScaledWidth() + openingXSize) / 2, - (scaledResolution.getScaledHeight() + openingYSize) / 2, - scaledResolution - ); + GlScissorStack.push((scaledResolution.getScaledWidth() - openingXSize) / 2, (scaledResolution.getScaledHeight() - openingYSize) / 2, (scaledResolution.getScaledWidth() + openingXSize) / 2, (scaledResolution.getScaledHeight() + openingYSize) / 2, scaledResolution); RenderUtils.drawFloatingRectDark(x + 5, y + 5, xSize - 10, 20, false); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - TextRenderUtils.drawStringCenteredScaledMaxWidth( - "SkyBlockHud by " + - EnumChatFormatting.RED + - "ThatGravyBoat" + - EnumChatFormatting.RESET + - ", config by " + - EnumChatFormatting.DARK_PURPLE + - "Moulberry", - fr, - x + xSize / 2f, - y + 15, - false, - 200, - 0xa0a0a0 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth("SkyBlockHud by " + EnumChatFormatting.RED + "ThatGravyBoat" + EnumChatFormatting.RESET + ", config by " + EnumChatFormatting.DARK_PURPLE + "Moulberry", fr, x + xSize / 2f, y + 15, false, 200, 0xa0a0a0); RenderUtils.drawFloatingRectDark(x + 4, y + 49 - 20, 140, ySize - 54 + 20, false); @@ -222,25 +189,15 @@ public class SBHConfigEditor extends GuiElement { catBarEnd = 1; 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())) - ); + categoryScroll.setValue((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())) - ); + categoryScroll.setValue((int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()))); } } int catDist = innerBottom - innerTop - 12; Gui.drawRect(innerLeft + 2, innerTop + 5, innerLeft + 7, innerBottom - 5, 0xff101010); - Gui.drawRect( - innerLeft + 3, - innerTop + 6 + (int) (catDist * catBarStart), - innerLeft + 6, - innerTop + 6 + (int) (catDist * catBarEnd), - 0xff303030 - ); + Gui.drawRect(innerLeft + 3, innerTop + 6 + (int) (catDist * catBarStart), innerLeft + 6, innerTop + 6 + (int) (catDist * catBarEnd), 0xff303030); GlScissorStack.pop(scaledResolution); @@ -258,15 +215,7 @@ public class SBHConfigEditor extends GuiElement { if (getSelectedCategory() != null && currentConfigEditing.containsKey(getSelectedCategory())) { ConfigProcessor.ProcessedCategory cat = currentConfigEditing.get(getSelectedCategory()); - TextRenderUtils.drawStringScaledMaxWidth( - cat.desc, - fr, - innerLeft + 5, - y + 40, - true, - innerRight - innerLeft - rightStuffLen - 10, - 0xb0b0b0 - ); + TextRenderUtils.drawStringScaledMaxWidth(cat.desc, fr, innerLeft + 5, y + 40, true, innerRight - innerLeft - rightStuffLen - 10, 0xb0b0b0); } Gui.drawRect(innerLeft, innerTop, innerLeft + 1, innerBottom, 0xff08080E); //Left @@ -361,25 +310,15 @@ public class SBHConfigEditor extends GuiElement { barEnd = 1; 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())) - ); + optionsScroll.setValue((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())) - ); + optionsScroll.setValue((int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()))); } } int dist = innerBottom - innerTop - 12; Gui.drawRect(innerRight - 10, innerTop + 5, innerRight - 5, innerBottom - 5, 0xff101010); - Gui.drawRect( - innerRight - 9, - innerTop + 6 + (int) (dist * barStart), - innerRight - 6, - innerTop + 6 + (int) (dist * barEnd), - 0xff303030 - ); + Gui.drawRect(innerRight - 9, innerTop + 6 + (int) (dist * barStart), innerRight - 6, innerTop + 6 + (int) (dist * barEnd), 0xff303030); for (int socialIndex = 0; socialIndex < socialsIco.length; socialIndex++) { Minecraft.getMinecraft().getTextureManager().bindTexture(socialsIco[socialIndex]); @@ -388,8 +327,7 @@ public class SBHConfigEditor extends GuiElement { RenderUtils.drawTexturedRect(socialLeft, y + 7, 16, 16, GL11.GL_LINEAR); if (mouseX >= socialLeft && mouseX <= socialLeft + 16 && mouseY >= y + 6 && mouseY <= y + 23) { - tooltipToDisplay = - Lists.newArrayList(EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex]); + tooltipToDisplay = Lists.newArrayList(EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex]); } } @@ -462,11 +400,7 @@ public class SBHConfigEditor extends GuiElement { float barSize = 1; int optionY = -newTarget; - if ( - getSelectedCategory() != null && - getCurrentConfigEditing() != null && - getCurrentConfigEditing().containsKey(getSelectedCategory()) - ) { + if (getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) { ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory()); Set activeAccordions = new HashSet<>(); for (ConfigProcessor.ProcessedOption option : getOptionsInCategory(cat).values()) { @@ -530,11 +464,7 @@ public class SBHConfigEditor extends GuiElement { } int optionY = -optionsScroll.getValue(); - if ( - getSelectedCategory() != null && - getCurrentConfigEditing() != null && - getCurrentConfigEditing().containsKey(getSelectedCategory()) - ) { + if (getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) { int optionWidthDefault = innerRight - innerLeft - 20; ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory()); Set activeAccordions = new HashSet<>(); @@ -557,15 +487,7 @@ public class SBHConfigEditor extends GuiElement { activeAccordions.add(accordion.getAccordionId()); } } - if ( - editor.mouseInputOverlay( - (innerLeft + innerRight - optionWidth) / 2 - 5, - innerTop + 5 + optionY, - optionWidth, - mouseX, - mouseY - ) - ) { + if (editor.mouseInputOverlay((innerLeft + innerRight - optionWidth) / 2 - 5, innerTop + 5 + optionY, optionWidth, mouseX, mouseY)) { return true; } optionY += editor.getHeight() + 5; @@ -574,11 +496,7 @@ public class SBHConfigEditor extends GuiElement { if (mouseX > innerLeft && mouseX < innerRight && mouseY > innerTop && mouseY < innerBottom) { optionY = -optionsScroll.getValue(); - if ( - getSelectedCategory() != null && - getCurrentConfigEditing() != null && - getCurrentConfigEditing().containsKey(getSelectedCategory()) - ) { + if (getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) { int optionWidthDefault = innerRight - innerLeft - 20; ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory()); Set activeAccordions = new HashSet<>(); @@ -601,15 +519,7 @@ public class SBHConfigEditor extends GuiElement { activeAccordions.add(accordion.getAccordionId()); } } - if ( - editor.mouseInput( - (innerLeft + innerRight - optionWidth) / 2 - 5, - innerTop + 5 + optionY, - optionWidth, - mouseX, - mouseY - ) - ) { + if (editor.mouseInput((innerLeft + innerRight - optionWidth) / 2 - 5, innerTop + 5 + optionY, optionWidth, mouseX, mouseY)) { return true; } optionY += editor.getHeight() + 5; @@ -631,11 +541,7 @@ public class SBHConfigEditor extends GuiElement { int innerPadding = 20 / adjScaleFactor; int innerWidth = xSize - 154 - innerPadding * 2; - if ( - getSelectedCategory() != null && - getCurrentConfigEditing() != null && - getCurrentConfigEditing().containsKey(getSelectedCategory()) - ) { + if (getSelectedCategory() != null && getCurrentConfigEditing() != null && getCurrentConfigEditing().containsKey(getSelectedCategory())) { ConfigProcessor.ProcessedCategory cat = getCurrentConfigEditing().get(getSelectedCategory()); Set activeAccordions = new HashSet<>(); for (ConfigProcessor.ProcessedOption option : getOptionsInCategory(cat).values()) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java b/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java index 7c252ad..a9d9d5d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/BackgroundBlur.java @@ -153,13 +153,7 @@ public class BackgroundBlur { } try { - blurShaderHorz = - new Shader( - Minecraft.getMinecraft().getResourceManager(), - "blur", - Minecraft.getMinecraft().getFramebuffer(), - blurOutputHorz - ); + blurShaderHorz = new Shader(Minecraft.getMinecraft().getResourceManager(), "blur", Minecraft.getMinecraft().getFramebuffer(), blurOutputHorz); blurShaderHorz.getShaderManager().getShaderUniform("BlurDir").set(1, 0); blurShaderHorz.setProjectionMatrix(createProjectionMatrix(width, height)); } catch (Exception ignored) {} @@ -193,15 +187,7 @@ public class BackgroundBlur { } } - public static void renderBlurredBackground( - float blurStrength, - int screenWidth, - int screenHeight, - int x, - int y, - int blurWidth, - int blurHeight - ) { + public static void renderBlurredBackground(float blurStrength, int screenWidth, int screenHeight, int x, int y, int blurWidth, int blurHeight) { renderBlurredBackground(blurStrength, screenWidth, screenHeight, x, y, blurWidth, blurHeight, false); } @@ -209,16 +195,7 @@ public class BackgroundBlur { * Renders a subsection of the blurred framebuffer on to the corresponding section of the screen. * Essentially, this method will "blur" the background inside the bounds specified by [x->x+blurWidth, y->y+blurHeight] */ - public static void renderBlurredBackground( - float blurStrength, - int screenWidth, - int screenHeight, - int x, - int y, - int blurWidth, - int blurHeight, - boolean forcedUpdate - ) { + public static void renderBlurredBackground(float blurStrength, int screenWidth, int screenHeight, int x, int y, int blurWidth, int blurHeight, boolean forcedUpdate) { if (!OpenGlHelper.isFramebufferEnabled() || !OpenGlHelper.areShadersSupported()) return; if (blurStrength < 0.5) return; requestedBlurs.add(blurStrength); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java index 7f8b9ba..2092b31 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementColour.java @@ -26,10 +26,7 @@ public class GuiElementColour extends GuiElement { 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 final GuiElementTextField hexField = new GuiElementTextField( - "", - GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE - ); + private final GuiElementTextField hexField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT | GuiElementTextField.FORCE_CAPS | GuiElementTextField.NO_SPACE); private int x; private int y; @@ -92,9 +89,7 @@ public class GuiElementColour extends GuiElement { bufferedImage.setRGB(x + 16, y + 16, (int) (blackAlpha * 255) << 24); } else { Color col = Color.getHSBColor(angle / 360f, 1, hsv[2]); - int rgb = (int) (col.getRed() * invBlackAlpha) << 16 | - (int) (col.getGreen() * invBlackAlpha) << 8 | - (int) (col.getBlue() * invBlackAlpha); + int rgb = (int) (col.getRed() * invBlackAlpha) << 16 | (int) (col.getGreen() * invBlackAlpha) << 8 | (int) (col.getBlue() * invBlackAlpha); bufferedImage.setRGB(x + 16, y + 16, 0xff000000 | rgb); } } @@ -145,21 +140,9 @@ public class GuiElementColour extends GuiElement { float hsvChroma[] = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null); if (chromaSpeed > 0) { - Gui.drawRect( - x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 1, - y + 5 + 1, - x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10 - 1, - y + 5 + 64 - 1, - Color.HSBtoRGB(hsvChroma[0], 0.8f, 0.8f) - ); + Gui.drawRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 1, y + 5 + 1, x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10 - 1, y + 5 + 64 - 1, Color.HSBtoRGB(hsvChroma[0], 0.8f, 0.8f)); } else { - Gui.drawRect( - x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 1, - 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) - ); + Gui.drawRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 1, 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)); } Minecraft.getMinecraft().getTextureManager().bindTexture(colour_selector_bar); @@ -174,28 +157,10 @@ public class GuiElementColour extends GuiElement { RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5, y + 5 + 27, 10, 10, GL11.GL_NEAREST); } - Gui.drawRect( - x + 5 + 64 + 5, - y + 5 + 64 - (int) (64 * hsv[2]), - x + 5 + 64 + 5 + 10, - y + 5 + 64 - (int) (64 * hsv[2]) + 1, - 0xFF000000 - ); - Gui.drawRect( - x + 5 + 64 + 5 + 10 + 5, - y + 5 + 64 - c.getAlpha() / 4, - x + 5 + 64 + 5 + 10 + 5 + 10, - y + 5 + 64 - c.getAlpha() / 4 - 1, - 0xFF000000 - ); + Gui.drawRect(x + 5 + 64 + 5, y + 5 + 64 - (int) (64 * hsv[2]), x + 5 + 64 + 5 + 10, y + 5 + 64 - (int) (64 * hsv[2]) + 1, 0xFF000000); + Gui.drawRect(x + 5 + 64 + 5 + 10 + 5, y + 5 + 64 - c.getAlpha() / 4, x + 5 + 64 + 5 + 10 + 5 + 10, y + 5 + 64 - c.getAlpha() / 4 - 1, 0xFF000000); if (chromaSpeed > 0) { - Gui.drawRect( - x + 5 + 64 + 5 + 10 + 5 + 10 + 5, - y + 5 + 64 - (int) (chromaSpeed / 255f * 64), - x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10, - y + 5 + 64 - (int) (chromaSpeed / 255f * 64) + 1, - 0xFF000000 - ); + Gui.drawRect(x + 5 + 64 + 5 + 10 + 5 + 10 + 5, y + 5 + 64 - (int) (chromaSpeed / 255f * 64), x + 5 + 64 + 5 + 10 + 5 + 10 + 5 + 10, y + 5 + 64 - (int) (chromaSpeed / 255f * 64) + 1, 0xFF000000); } Minecraft.getMinecraft().getTextureManager().loadTexture(colourPickerLocation, new DynamicTexture(bufferedImage)); @@ -207,34 +172,10 @@ public class GuiElementColour extends GuiElement { GlStateManager.color(1, 1, 1, 1); RenderUtils.drawTexturedRect(x + 5 + 32 + selx - 4, y + 5 + 32 + sely - 4, 8, 8, GL11.GL_NEAREST); - TextRenderUtils.drawStringCenteredScaledMaxWidth( - EnumChatFormatting.GRAY.toString() + Math.round(hsv[2] * 100) + "", - Minecraft.getMinecraft().fontRendererObj, - x + 5 + 64 + 5 + 5 - (Math.round(hsv[2] * 100) == 100 ? 1 : 0), - y + 5 + 64 + 5 + 5, - true, - 13, - -1 - ); - TextRenderUtils.drawStringCenteredScaledMaxWidth( - EnumChatFormatting.GRAY.toString() + Math.round(c.getAlpha() / 255f * 100) + "", - Minecraft.getMinecraft().fontRendererObj, - x + 5 + 64 + 5 + 15 + 5, - y + 5 + 64 + 5 + 5, - true, - 13, - -1 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + Math.round(hsv[2] * 100) + "", Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + 5 - (Math.round(hsv[2] * 100) == 100 ? 1 : 0), y + 5 + 64 + 5 + 5, true, 13, -1); + TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + Math.round(c.getAlpha() / 255f * 100) + "", Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + 15 + 5, y + 5 + 64 + 5 + 5, true, 13, -1); if (chromaSpeed > 0) { - TextRenderUtils.drawStringCenteredScaledMaxWidth( - EnumChatFormatting.GRAY.toString() + (int) ChromaColour.getSecondsForSpeed(chromaSpeed) + "s", - Minecraft.getMinecraft().fontRendererObj, - x + 5 + 64 + 5 + 30 + 6, - y + 5 + 64 + 5 + 5, - true, - 13, - -1 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(EnumChatFormatting.GRAY.toString() + (int) ChromaColour.getSecondsForSpeed(chromaSpeed) + "s", Minecraft.getMinecraft().fontRendererObj, x + 5 + 64 + 5 + 30 + 6, y + 5 + 64 + 5 + 5, true, 13, -1); } hexField.setSize(48, 10); @@ -253,13 +194,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 mouseYF = (float) ( - scaledResolution.getScaledHeight_double() - - Mouse.getY() * - scaledResolution.getScaledHeight_double() / - Minecraft.getMinecraft().displayHeight - - 1 - ); + float mouseYF = (float) (scaledResolution.getScaledHeight_double() - Mouse.getY() * scaledResolution.getScaledHeight_double() / Minecraft.getMinecraft().displayHeight - 1); if ((Mouse.getEventButton() == 0 || Mouse.getEventButton() == 1) && Mouse.getEventButtonState()) { if (mouseX > x + 5 + 8 && mouseX < x + 5 + 8 + 48) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java index 54db59b..867efc1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/GuiElementTextField.java @@ -276,8 +276,7 @@ public class GuiElementTextField { linePos++; } } - int newPos = - textField.getSelectionEnd() - strLenNoColor(thisLineBeforeCursor) - strLenNoColor(lineBefore) - 1 + linePos; + int newPos = textField.getSelectionEnd() - strLenNoColor(thisLineBeforeCursor) - strLenNoColor(lineBefore) - 1 + linePos; if (GuiScreen.isShiftKeyDown()) { textField.setSelectionPos(newPos); @@ -317,12 +316,7 @@ public class GuiElementTextField { linePos++; } } - int newPos = - textField.getSelectionEnd() - - strLenNoColor(thisLineBeforeCursor) + - strLenNoColor(split2[numLinesBeforeCursor]) + - 1 + - linePos; + int newPos = textField.getSelectionEnd() - strLenNoColor(thisLineBeforeCursor) + strLenNoColor(split2[numLinesBeforeCursor]) + 1 + linePos; if (GuiScreen.isShiftKeyDown()) { textField.setSelectionPos(newPos); @@ -367,15 +361,7 @@ public class GuiElementTextField { drawTextbox(x, y, searchBarXSize, searchBarYSize, searchBarPadding, textField, focus); } - private void drawTextbox( - int x, - int y, - int searchBarXSize, - int searchBarYSize, - int searchBarPadding, - GuiTextField textField, - boolean focus - ) { + private void drawTextbox(int x, int y, int searchBarXSize, int searchBarYSize, int searchBarPadding, GuiTextField textField, boolean focus) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); String renderText = prependText + textField.getText(); @@ -396,13 +382,7 @@ public class GuiElementTextField { borderColour = customBorderColour; } //bar background - Gui.drawRect( - x - paddingUnscaled, - y - paddingUnscaled, - x + searchBarXSize + paddingUnscaled, - bottomTextBox + paddingUnscaled, - borderColour - ); + Gui.drawRect(x - paddingUnscaled, y - paddingUnscaled, x + searchBarXSize + paddingUnscaled, bottomTextBox + paddingUnscaled, borderColour); Gui.drawRect(x, y, x + searchBarXSize, bottomTextBox, Color.BLACK.getRGB()); //bar text @@ -437,34 +417,16 @@ public class GuiElementTextField { float newLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(texts[yOffI]) * scale; xStartOffset = (int) ((searchBarXSize - newLen) / 2f); - TextRenderUtils.drawStringCenteredScaledMaxWidth( - texts[yOffI], - Minecraft.getMinecraft().fontRendererObj, - x + searchBarXSize / 2f, - y + searchBarYSize / 2f + yOff, - false, - searchBarXSize - 2, - Color.WHITE.getRGB() - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(texts[yOffI], Minecraft.getMinecraft().fontRendererObj, x + searchBarXSize / 2f, y + searchBarYSize / 2f + yOff, false, searchBarXSize - 2, Color.WHITE.getRGB()); } else { - Minecraft - .getMinecraft() - .fontRendererObj.drawString( - StringUtils.trimToWidth(texts[yOffI], searchBarXSize - 10), - x + 5, - y + (searchBarYSize - 8) / 2 + yOff, - Color.WHITE.getRGB() - ); + Minecraft.getMinecraft().fontRendererObj.drawString(StringUtils.trimToWidth(texts[yOffI], searchBarXSize - 10), x + 5, y + (searchBarYSize - 8) / 2 + yOff, Color.WHITE.getRGB()); } } if (focus && System.currentTimeMillis() % 1000 > 500) { String textNCBeforeCursor = textNoColor.substring(0, textField.getCursorPosition() + prependText.length()); int colorCodes = org.apache.commons.lang3.StringUtils.countMatches(textNCBeforeCursor, "\u00B6"); - String textBeforeCursor = text.substring( - 0, - textField.getCursorPosition() + prependText.length() + (((options & COLOUR) != 0) ? colorCodes * 2 : 0) - ); + String textBeforeCursor = text.substring(0, textField.getCursorPosition() + prependText.length() + (((options & COLOUR) != 0) ? colorCodes * 2 : 0)); int numLinesBeforeCursor = org.apache.commons.lang3.StringUtils.countMatches(textBeforeCursor, "\n"); int yOff = numLinesBeforeCursor * extraSize; @@ -476,26 +438,14 @@ public class GuiElementTextField { } else { textBeforeCursorWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(split[split.length - 1]) * scale); } - Gui.drawRect( - x + xStartOffset + textBeforeCursorWidth, - y + (searchBarYSize - 8) / 2 - 1 + yOff, - x + xStartOffset + textBeforeCursorWidth + 1, - y + (searchBarYSize - 8) / 2 + 9 + yOff, - Color.WHITE.getRGB() - ); + Gui.drawRect(x + xStartOffset + textBeforeCursorWidth, y + (searchBarYSize - 8) / 2 - 1 + yOff, x + xStartOffset + textBeforeCursorWidth + 1, y + (searchBarYSize - 8) / 2 + 9 + yOff, Color.WHITE.getRGB()); } String selectedText = textField.getSelectedText(); if (!selectedText.isEmpty()) { System.out.println("Start"); - int leftIndex = Math.min( - textField.getCursorPosition() + prependText.length(), - textField.getSelectionEnd() + prependText.length() - ); - int rightIndex = Math.max( - textField.getCursorPosition() + prependText.length(), - textField.getSelectionEnd() + prependText.length() - ); + int leftIndex = Math.min(textField.getCursorPosition() + prependText.length(), textField.getSelectionEnd() + prependText.length()); + int rightIndex = Math.max(textField.getCursorPosition() + prependText.length(), textField.getSelectionEnd() + prependText.length()); float texX = 0; int texY = 0; @@ -523,13 +473,7 @@ public class GuiElementTextField { if (c == '\n') { if (i >= leftIndex && i < rightIndex) { - Gui.drawRect( - x + xStartOffset + (int) texX, - y + (searchBarYSize - 8) / 2 - 1 + texY, - x + xStartOffset + (int) texX + 3, - y + (searchBarYSize - 8) / 2 + 9 + texY, - Color.LIGHT_GRAY.getRGB() - ); + Gui.drawRect(x + xStartOffset + (int) texX, y + (searchBarYSize - 8) / 2 - 1 + texY, x + xStartOffset + (int) texX + 3, y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB()); } texX = 0; @@ -543,33 +487,11 @@ public class GuiElementTextField { int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(String.valueOf(c)); if (bold) len++; if (i >= leftIndex && i < rightIndex) { - Gui.drawRect( - x + xStartOffset + (int) texX, - y + (searchBarYSize - 8) / 2 - 1 + texY, - x + xStartOffset + (int) (texX + len * scale), - y + (searchBarYSize - 8) / 2 + 9 + texY, - Color.LIGHT_GRAY.getRGB() - ); - - TextRenderUtils.drawStringScaled( - String.valueOf(c), - Minecraft.getMinecraft().fontRendererObj, - x + xStartOffset + texX, - y + searchBarYSize / 2f - scale * 8 / 2f + texY, - false, - Color.BLACK.getRGB(), - scale - ); + Gui.drawRect(x + xStartOffset + (int) texX, y + (searchBarYSize - 8) / 2 - 1 + texY, x + xStartOffset + (int) (texX + len * scale), y + (searchBarYSize - 8) / 2 + 9 + texY, Color.LIGHT_GRAY.getRGB()); + + TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, x + xStartOffset + texX, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale); if (bold) { - TextRenderUtils.drawStringScaled( - String.valueOf(c), - Minecraft.getMinecraft().fontRendererObj, - x + xStartOffset + texX + 1, - y + searchBarYSize / 2f - scale * 8 / 2f + texY, - false, - Color.BLACK.getRGB(), - scale - ); + TextRenderUtils.drawStringScaled(String.valueOf(c), Minecraft.getMinecraft().fontRendererObj, x + xStartOffset + texX + 1, y + searchBarYSize / 2f - scale * 8 / 2f + texY, false, Color.BLACK.getRGB(), scale); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java index 7888587..dad85a6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorAccordion.java @@ -60,15 +60,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - TextRenderUtils.drawStringScaledMaxWidth( - option.name, - Minecraft.getMinecraft().fontRendererObj, - x + 18, - y + 6, - false, - width - 10, - 0xc0c0c0 - ); + TextRenderUtils.drawStringScaledMaxWidth(option.name, Minecraft.getMinecraft().fontRendererObj, x + 18, y + 6, false, width - 10, 0xc0c0c0); } @Override 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 d3dc74f..1950c27 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 @@ -37,15 +37,7 @@ public class GuiOptionEditorButton extends GuiOptionEditor { RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16); if (buttonText != null) { - TextRenderUtils.drawStringCenteredScaledMaxWidth( - buttonText, - Minecraft.getMinecraft().fontRendererObj, - x + width / 6, - y + height - 7 - 6, - false, - 44, - 0xFF303030 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth(buttonText, Minecraft.getMinecraft().fontRendererObj, x + width / 6, y + height - 7 - 6, false, 44, 0xFF303030); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java index e64d14c..95bc868 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiOptionEditorColour.java @@ -50,14 +50,7 @@ public class GuiOptionEditorColour extends GuiOptionEditor { public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) { int height = getHeight(); - if ( - Mouse.getEventButtonState() && - Mouse.getEventButton() == 0 && - mouseX > x + width / 6 - 24 && - mouseX < x + width / 6 + 24 && - mouseY > y + height - 7 - 14 && - mouseY < y + height - 7 + 2 - ) { + if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0 && mouseX > x + width / 6 - 24 && mouseX < x + width / 6 + 24 && mouseY > y + height - 7 - 14 && mouseY < y + height - 7 + 2) { colourElement = new GuiElementColour( mouseX, 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 6de0223..e0a9064 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 @@ -63,15 +63,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex); RenderUtils.drawTexturedRect(x + width / 6f - 24, y + 45 - 7 - 14, 48, 16); - TextRenderUtils.drawStringCenteredScaledMaxWidth( - "Add", - Minecraft.getMinecraft().fontRendererObj, - x + width / 6f, - y + 45 - 7 - 6, - false, - 44, - 0xFF303030 - ); + TextRenderUtils.drawStringCenteredScaledMaxWidth("Add", Minecraft.getMinecraft().fontRendererObj, x + width / 6f, y + 45 - 7 - 6, false, 44, 0xFF303030); long currentTime = System.currentTimeMillis(); float greenBlue = LerpUtils.clampZeroOne(((trashHoverTime < 0 ? 250 : 0) + trashHoverTime - currentTime) / 250f); @@ -94,15 +86,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { if (i++ != dragStartIndex) { for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) { String line = multilines[multilineIndex]; - Utils.drawStringScaledMaxWidth( - line + EnumChatFormatting.RESET, - Minecraft.getMinecraft().fontRendererObj, - x + 20, - y + 50 + yOff + multilineIndex * 10, - true, - width - 20, - 0xffffffff - ); + Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, x + 20, y + 50 + yOff + multilineIndex * 10, true, width - 20, 0xffffffff); } Minecraft.getMinecraft().fontRendererObj.drawString("\u2261", x + 10, y + 50 + yOff + ySize / 2f - 4, 0xffffff, true); } @@ -143,15 +127,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { if (str.isEmpty()) { str = ""; } - TextRenderUtils.drawStringScaledMaxWidth( - str.replaceAll("(\n.*)+", " ..."), - fr, - left + 3, - top + 3 + dropdownY, - false, - dropdownWidth - 6, - 0xffa0a0a0 -