diff options
author | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:27:11 -0400 |
---|---|---|
committer | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:27:11 -0400 |
commit | 804767ebfc26e2a1252bc327def02389b35dfc6e (patch) | |
tree | e3e06c24454080f059355133d633e5a076d85ad3 /src/main/java/com | |
parent | 98ee5a2ae8090c061b1e61e7955d793416991822 (diff) | |
download | SkyblockHud-Death-Defied-804767ebfc26e2a1252bc327def02389b35dfc6e.tar.gz SkyblockHud-Death-Defied-804767ebfc26e2a1252bc327def02389b35dfc6e.tar.bz2 SkyblockHud-Death-Defied-804767ebfc26e2a1252bc327def02389b35dfc6e.zip |
fine
Diffstat (limited to 'src/main/java/com')
43 files changed, 220 insertions, 1694 deletions
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<Item> redstoneItems = new ArrayList<>( - Arrays.asList(Items.redstone, Items.repeater, Items.comparator, Item.getByNameOrId("minecraft:redstone_torch")) - ); + ArrayList<Item> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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 = "<NONE>"; } - TextRenderUtils.drawStringScaledMaxWidth( - str.replaceAll("(\n.*)+", " ..."), - fr, - left + 3, - top + 3 + dropdownY, - false, - dropdownWidth - 6, - 0xffa0a0a0 - ); + TextRenderUtils.drawStringScaledMaxWidth(str.replaceAll("(\n.*)+", " ..."), fr, left + 3, top + 3 + dropdownY, false, dropdownWidth - 6, 0xffa0a0a0); dropdownY += 12; } } else if (currentDragging >= 0) { @@ -169,12 +145,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); int mouseX = Mouse.getX() * scaledResolution.getScaledWidth() / Minecraft.getMinecraft().displayWidth; - int mouseY = - scaledResolution.getScaledHeight() - - Mouse.getY() * - scaledResolution.getScaledHeight() / - Minecraft.getMinecraft().displayHeight - - 1; + int mouseY = scaledResolution.getScaledHeight() - Mouse.getY() * scaledResolution.getScaledHeight() / Minecraft.getMinecraft().displayHeight - 1; String str = exampleText[currentDragging]; @@ -183,37 +154,18 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { GlStateManager.enableBlend(); for (int multilineIndex = 0; multilineIndex < multilines.length; multilineIndex++) { String line = multilines[multilineIndex]; - Utils.drawStringScaledMaxWidth( - line + EnumChatFormatting.RESET, - Minecraft.getMinecraft().fontRendererObj, - dragOffsetX + mouseX + 10, - dragOffsetY + mouseY + multilineIndex * 10, - true, - width - 20, - 0xffffff | (opacity << 24) - ); + Utils.drawStringScaledMaxWidth(line + EnumChatFormatting.RESET, Minecraft.getMinecraft().fontRendererObj, dragOffsetX + mouseX + 10, dragOffsetY + mouseY + multilineIndex * 10, true, width - 20, 0xffffff | (opacity << 24)); } int ySize = multilines.length * 10; - Minecraft - .getMinecraft() - .fontRendererObj.drawString("\u2261", dragOffsetX + mouseX, dragOffsetY + mouseY + ySize / 2f - 4, 0xffffff, true); + Minecraft.getMinecraft().fontRendererObj.drawString("\u2261", dragOffsetX + mouseX, dragOffsetY + mouseY + ySize / 2f - 4, 0xffffff, true); } } @Override public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) { - if ( - !Mouse.getEventButtonState() && - !dropdownOpen && - dragStartIndex >= 0 && - Mouse.getEventButton() == 0 && - mouseX >= x + width / 6 + 27 - 3 && - mouseX <= x + width / 6 + 27 + 11 + 3 && - mouseY >= y + 45 - 7 - 13 - 3 && - mouseY <= y + 45 - 7 - 13 + 14 + 3 - ) { + if (!Mouse.getEventButtonState() && !dropdownOpen && dragStartIndex >= 0 && Mouse.getEventButton() == 0 && mouseX >= x + width / 6 + 27 - 3 && mouseX <= x + width / 6 + 27 + 11 + 3 && mouseY >= y + 45 - 7 - 13 - 3 && mouseY <= y + 45 - 7 - 13 + 14 + 3) { activeText.remove(dragStartIndex); currentDragging = -1; dragStartIndex = -1; @@ -224,13 +176,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { currentDragging = -1; dragStartIndex = -1; if (trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis(); - } else if ( - currentDragging >= 0 && - mouseX >= x + width / 6 + 27 - 3 && - mouseX <= x + width / 6 + 27 + 11 + 3 && - mouseY >= y + 45 - 7 - 13 - 3 && - mouseY <= y + 45 - 7 - 13 + 14 + 3 - ) { + } else if (currentDragging >= 0 && mouseX >= x + width / 6 + 27 - 3 && mouseX <= x + width / 6 + 27 + 11 + 3 && mouseY >= y + 45 - 7 - 13 - 3 && mouseY <= y + 45 - 7 - 13 + 14 + 3) { if (trashHoverTime < 0) trashHoverTime = System.currentTimeMillis(); } else { if (trashHoverTime > 0) trashHoverTime = -System.currentTimeMillis(); @@ -269,13 +215,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor { return true; } - if ( - activeText.size() < exampleText.length && - mouseX > x + width / 6 - 24 && - mouseX < x + width / 6 + 24 && - mouseY > y + 45 - 7 - 14 && - mouseY < y + 45 - 7 + 2 - ) { + if (activeText.size() < exampleText.length && mouseX > x + width / 6 - 24 && mouseX < x + width / 6 + 24 && mouseY > y + 45 - 7 - 14 && mouseY < y + 45 - 7 + 2) { dropdownOpen = !dropdownOpen; dragOffsetX = mouseX; dragOffsetY = mouseY; 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 1e27684..49376e4 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 @@ -25,11 +25,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor { } else { strVal = Float.toString(floatVal); } - textField = - new GuiElementTextField( - strVal, - GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT - ); + textField = new GuiElementTextField(strVal, GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT); } slider = diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java index 0fae02e..1f31ec7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/config/gui/GuiPositionEditor.java @@ -26,14 +26,7 @@ public class GuiPositionEditor extends GuiScreen { private int guiScaleOverride = -1; - public GuiPositionEditor( - Position position, - int elementWidth, - int elementHeight, - Runnable renderCallback, - Runnable positionChangedCallback, - Runnable closedCallback - ) { + public GuiPositionEditor(Position position, int elementWidth, int elementHeight, Runnable renderCallback, Runnable positionChangedCallback, Runnable closedCallback) { this.position = position; this.originalPosition = position.clone(); this.elementWidth = elementWidth == -1 ? this.width : elementWidth; @@ -90,22 +83,8 @@ public class GuiPositionEditor extends GuiScreen { } scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - Utils.drawStringCentered( - "Position Editor", - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth() / 2f, - 8, - true, - 0xffffff - ); - Utils.drawStringCentered( - "R to Reset - Arrow keys/mouse to move", - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth() / 2f, - 18, - true, - 0xffffff - ); + Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2f, 8, true, 0xffffff); + Utils.drawStringCentered("R to Reset - Arrow keys/mouse to move", Minecraft.getMinecraft().fontRendererObj, scaledResolution.getScaledWidth() / 2f, 18, true, 0xffffff); } @Override 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 5b51f34..f1f8733 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 @@ -91,13 +91,7 @@ public class ConfigProcessor { if (optionPresent) { ConfigOption optionAnnotation = optionField.getAnnotation(ConfigOption.class); - ProcessedOption option = new ProcessedOption( - optionAnnotation.name(), - optionAnnotation.desc(), - optionAnnotation.subcategoryId(), - optionField, - categoryObj - ); + ProcessedOption option = new ProcessedOption(optionAnnotation.name(), optionAnnotation.desc(), optionAnnotation.subcategoryId(), optionField, categoryObj); if (optionField.isAnnotationPresent(ConfigAccordionId.class)) { ConfigAccordionId annotation = optionField.getAnnotation(ConfigAccordionId.class); option.accordionId = annotation.id(); @@ -107,13 +101,7 @@ public class ConfigProcessor { Class<?> optionType = optionField.getType(); if (optionField.isAnnotationPresent(ConfigEditorButton.class)) { ConfigEditorButton configEditorAnnotation = optionField.getAnnotation(ConfigEditorButton.class); - editor = - new GuiOptionEditorButton( - option, - configEditorAnnotation.runnableId(), - configEditorAnnotation.buttonText(), - config - ); + editor = new GuiOptionEditorButton(option, configEditorAnnotation.runnableId(), configEditorAnnotation.buttonText(), config); } if (optionType.isAssignableFrom(boolean.class) && optionField.isAnnotationPresent(ConfigEditorBoolean.class)) { editor = new GuiOptionEditorBoolean(option); @@ -130,42 +118,24 @@ public class ConfigProcessor { } if (optionType.isAssignableFrom(List.class)) { if (optionField.isAnnotationPresent(ConfigEditorDraggableList.class)) { - ConfigEditorDraggableList configEditorAnnotation = optionField.getAnnotation( - ConfigEditorDraggableList.class - ); + ConfigEditorDraggableList configEditorAnnotation = optionField.getAnnotation(ConfigEditorDraggableList.class); editor = new GuiOptionEditorDraggableList(option, configEditorAnnotation.exampleText()); } } if (optionType.isAssignableFrom(String.class)) { if (optionField.isAnnotationPresent(ConfigEditorDropdown.class)) { ConfigEditorDropdown configEditorAnnotation = optionField.getAnnotation(ConfigEditorDropdown.class); - editor = - new GuiOptionEditorDropdown( - option, - configEditorAnnotation.values(), - configEditorAnnotation.initialIndex(), - false - ); + editor = new GuiOptionEditorDropdown(option, configEditorAnnotation.values(), configEditorAnnotation.initialIndex(), false); } else if (optionField.isAnnotationPresent(ConfigEditorColour.class)) { editor = new GuiOptionEditorColour(option); } else if (optionField.isAnnotationPresent(ConfigEditorText.class)) { editor = new GuiOptionEditorText(option); } } - if ( - optionType.isAssignableFrom(int.class) || - optionType.isAssignableFrom(float.class) || - optionType.isAssignableFrom(double.class) - ) { + if (optionType.isAssignableFrom(int.class) || optionType.isAssignableFrom(float.class) || optionType.isAssignableFrom(double.class)) { if (optionField.isAnnotationPresent(ConfigEditorSlider.class)) { ConfigEditorSlider configEditorAnnotation = optionField.getAnnotation(ConfigEditorSlider.class); - editor = - new GuiOptionEditorSlider( - option, - configEditorAnnotation.minValue(), - configEditorAnnotation.maxValue(), - configEditorAnnotation.minStep() - ); + editor = new GuiOptionEditorSlider(option, configEditorAnnotation.minValue(), configEditorAnnotation.maxValue(), configEditorAnnotation.minStep()); } } if (optionType.isAssignableFrom(String.class)) { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java index bc9a694..9d9fcbd 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/GuiElementSlider.java @@ -27,16 +27,7 @@ public class GuiElementSlider extends GuiElement { private boolean clicked = false; - public GuiElementSlider( - int x, - int y, - int width, - float minValue, - float maxValue, - float minStep, - float value, - Consumer<Float> setCallback - ) { + public GuiElementSlider(int x, int y, int width, float minValue, float maxValue, float minStep, float value, Consumer<Float> setCallback) { if (minStep < 0) minStep = 0.01f; this.x = x; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java index 963e1f7..bbaabb8 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/RenderUtils.java @@ -23,16 +23,7 @@ public class RenderUtils { if (OpenGlHelper.isFramebufferEnabled()) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - BackgroundBlur.renderBlurredBackground( - 15, - scaledResolution.getScaledWidth(), - scaledResolution.getScaledHeight(), - x, - y, - width, - height, - true - ); + BackgroundBlur.renderBlurredBackground(15, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), x, y, width, height, true); } else { alpha = 0xff000000; } @@ -95,17 +86,7 @@ public class RenderUtils { drawTexturedRect(x, y, width, height, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); } - 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.enableBlend(); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -114,17 +95,7 @@ public class RenderUtils { GlStateManager.disableBlend(); } - public static void drawTexturedRectNoBlend( - float x, - float y, - float width, - float height, - float uMin, - float uMax, - float vMin, - float vMax, - int filter - ) { + public static void drawTexturedRectNoBlend(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) { GlStateManager.enableTexture2D(); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java index f160c04..7745562 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/core/util/render/TextRenderUtils.java @@ -71,15 +71,7 @@ public class TextRenderUtils { GlStateManager.scale(1 / factor, 1 / factor, 1); } - public static void drawStringCenteredScaledMaxWidth( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringCenteredScaledMaxWidth(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); @@ -91,10 +83,7 @@ public class TextRenderUtils { } public static void renderToolTip(ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontStd) { - List<String> list = stack.getTooltip( - Minecraft.getMinecraft().thePlayer, - Minecraft.getMinecraft().gameSettings.advancedItemTooltips - ); + List<String> list = stack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); for (int i = 0; i < list.size(); ++i) { if (i == 0) { @@ -108,15 +97,7 @@ public class TextRenderUtils { drawHoveringText(list, mouseX, mouseY, screenWidth, screenHeight, -1, font == null ? fontStd : font); } - public static void drawHoveringText( - List<String> textLines, - final int mouseX, - final int mouseY, - final int screenWidth, - final int screenHeight, - final int maxTextWidth, - FontRenderer font - ) { + public static void drawHoveringText(List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font) { if (!textLines.isEmpty()) { GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); @@ -197,89 +178,17 @@ public class TextRenderUtils { final int zLevel = 300; final int backgroundColor = 0xF0100010; - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 4, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3, - backgroundColor, - backgroundColor - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY + tooltipHeight + 3, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 4, - backgroundColor, - backgroundColor - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 4, - tooltipY - 3, - tooltipX - 3, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 4, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + RenderUtils.drawGradientRect(zLevel, tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + RenderUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); final int borderColorStart = 0x505000FF; final int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000; - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3 + 1, - tooltipX - 3 + 1, - tooltipY + tooltipHeight + 3 - 1, - borderColorStart, - borderColorEnd - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX + tooltipTextWidth + 2, - tooltipY - 3 + 1, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3 - 1, - borderColorStart, - borderColorEnd - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3 + 1, - borderColorStart, - borderColorStart - ); - RenderUtils.drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY + tooltipHeight + 2, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, - borderColorEnd, - borderColorEnd - ); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + RenderUtils.drawGradientRect(zLevel, tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); + RenderUtils.drawGradientRect(zLevel, tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) { String line = textLines.get(lineNumber); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java index aff9c1e..2418b13 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/dungeons/DungeonHandler.java @@ -124,11 +124,7 @@ public class DungeonHandler { public static void parseDeaths(String playerName) { if (playerName.toLowerCase().contains("deaths:")) { - String death = Utils - .removeColor(playerName.toLowerCase().replace("deaths:", "")) - .replace("(", "") - .replace(")", "") - .replace(" ", ""); + String death = Utils.removeColor(playerName.toLowerCase().replace("deaths:", "")).replace("(", "").replace(")", "").replace(" ", ""); try { deaths = Integer.parseInt(death); } catch (NumberFormatException ignored) {} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java index 6f06f40..b2a148d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/BossbarHandler.java @@ -22,11 +22,7 @@ public class BossbarHandler { bossBarRendered = false; } String bossName = Utils.removeColor(BossStatus.bossName); - if ( - SkyblockHud.config.renderer.hideBossBar && - DwarvenMineHandler.currentEvent == DwarvenMineHandler.Event.NONE && - !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS) - ) { + if (SkyblockHud.config.renderer.hideBossBar && DwarvenMineHandler.currentEvent == DwarvenMineHandler.Event.NONE && !LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { if (bossName.equalsIgnoreCase("wither")) { event.setCanceled(true); bossBarRendered = false; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java index 847b6c7..7da9c9d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CurrencyHandler.java @@ -34,16 +34,10 @@ public class CurrencyHandler { @SubscribeEvent public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { - if ( - Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("purse:") || - Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("piggy:") - ) { + if (Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("purse:") || Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("piggy:")) { CurrencyHandler.checkCoins(event.formattedLine); } - if ( - Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("bits:") && - !event.formattedLine.toLowerCase().contains("(") - ) { + if (Utils.removeColor(event.formattedLine.toLowerCase().trim()).contains("bits:") && !event.formattedLine.toLowerCase().contains("(")) { CurrencyHandler.checkBits(event.formattedLine); } } @@ -69,12 +63,7 @@ public class CurrencyHandler { } public static void checkCoins(String formatedScoreboardLine) { - String purse = Utils - .removeWhiteSpaceAndRemoveWord( - Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()), - Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("purse:") ? "purse:" : "piggy:" - ) - .replace(",", ""); + String purse = Utils.removeWhiteSpaceAndRemoveWord(Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()), Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("purse:") ? "purse:" : "piggy:").replace(",", ""); if (!purse.contains("(") && !purse.contains("+")) { try { double coins = Double.parseDouble(Pattern.compile("[^0-9.]").matcher(purse).replaceAll("")); @@ -86,9 +75,7 @@ public class CurrencyHandler { } public static void checkBits(String formatedScoreboardLine) { - String bits = Utils - .removeWhiteSpaceAndRemoveWord(Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()), "bits:") - .replace(",", ""); + String bits = Utils.removeWhiteSpaceAndRemoveWord(Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()), "bits:").replace(",", ""); try { int bit = Integer.parseInt(Pattern.compile("[^0-9]").matcher(bits).replaceAll("")); CurrencyHandler.setBits(bit); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java index c8ef43b..b7b232f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java @@ -58,11 +58,7 @@ public class MapHandler { public boolean canRender() { SBHConfig.Map mapConfig = SkyblockHud.config.map; - if (mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)) return true; else if ( - mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC) - ) return true; else if (mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)) return true; else if ( - mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST) - ) return true; else return (mapConfig.showShopIcons && type.equals(MapIconTypes.SHOPS)); + if (mapConfig.showInfoIcons && type.equals(MapIconTypes.INFO)) return true; else if (mapConfig.showMiscIcons && type.equals(MapIconTypes.MISC)) return true; else if (mapConfig.showNpcIcons && type.equals(MapIconTypes.NPC)) return true; else if (mapConfig.showQuestIcons && type.equals(MapIconTypes.QUEST)) return true; else return (mapConfig.showShopIcons && type.equals(MapIconTypes.SHOPS)); } } @@ -85,17 +81,7 @@ public class MapHandler { public ResourceLocation mapTexture; public List<MapIcon> icons; - Maps( - float scaleFactor, - int width, - int height, - int xMiniOffset, - int yMiniOffset, - int xOffset, - int yOffset, - ResourceLocation mapTexture, - List<MapIcon> icons - ) { + Maps(float scaleFactor, int width, int height, int xMiniOffset, int yMiniOffset, int xOffset, int yOffset, ResourceLocation mapTexture, List<MapIcon> icons) { this.scaleFactor = scaleFactor; this.width = width; this.height = height; @@ -119,16 +105,7 @@ public class MapHandler { mc.renderEngine.bindTexture(mapOverlay); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); Position pos = SkyblockHud.config.map.miniMapPosition; - Gui.drawModalRectWithCustomSizedTexture( - pos.getAbsX(event.resolution, 72), - pos.getAbsY(event.resolution, 72), - 72, - 0, - 72, - 72, - 256, - 256 - ); + Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72), pos.getAbsY(event.resolution, 72), 72, 0, 72, 72, 256, 256); mc.renderEngine.bindTexture(map.mapTexture); int x = mc.thePlayer.getPosition().getX() + map.xMiniOffset; @@ -139,60 +116,20 @@ public class MapHandler { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); - Gui.drawModalRectWithCustomSizedTexture( - pos.getAbsX(event.resolution, 72) + 4, - pos.getAbsY(event.resolution, 72) + 2, - u, - v, - 64, - 64, - 256, - 256 - ); + Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72) + 4, pos.getAbsY(event.resolution, 72) + 2, u, v, 64, 64, 256, 256); if (SkyblockHud.config.map.showPlayerLocation) { - mc.fontRendererObj.drawString( - "\u2022", - pos.getAbsX(event.resolution, 72) + 36, - pos.getAbsY(event.resolution, 72) + 34, - 0xff0000, - false - ); + mc.fontRendererObj.drawString("\u2022", pos.getAbsX(event.resolution, 72) + 36, pos.getAbsY(event.resolution, 72) + 34, 0xff0000, false); } GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); mc.renderEngine.bindTexture(mapOverlay); - Gui.drawModalRectWithCustomSizedTexture( - pos.getAbsX(event.resolution, 72), - pos.getAbsY(event.resolution, 72), - 0, - 0, - 72, - 72, - 256, - 256 - ); + Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72), pos.getAbsY(event.resolution, 72), 0, 0, 72, 72, 256, 256); String keyCode = GameSettings.getKeyDisplayString(KeyBindings.map.getKeyCode()); - Utils.drawStringCenteredScaled( - keyCode, - mc.fontRendererObj, - pos.getAbsX(event.resolution, 64) + 58, - pos.getAbsY(event.resolution, 72) + 66, - false, - 6, - 0xFFFFFF - ); + Utils.drawStringCenteredScaled(keyCode, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 58, pos.getAbsY(event.resolution, 72) + 66, false, 6, 0xFFFFFF); BlockPos playerPos = mc.thePlayer.getPosition(); String position = String.format("%d/%d/%d", playerPos.getX(), playerPos.getY(), playerPos.getZ()); - Utils.drawStringCenteredScaled( - position, - mc.fontRendererObj, - pos.getAbsX(event.resolution, 64) + 29, - pos.getAbsY(event.resolution, 72) + 66, - false, - 36, - 0xFFFFFF - ); + Utils.drawStringCenteredScaled(position, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 29, pos.getAbsY(event.resolution, 72) + 66, false, 36, 0xFFFFFF); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); } } @@ -200,11 +137,7 @@ public class MapHandler { @SubscribeEvent public void clientTick(TickEvent.ClientTickEvent event) { - if ( - KeyBindings.map.isPressed() && - LocationHandler.getCurrentLocation().getCategory().getMap() != null && - SkyblockHud.hasSkyblockScoreboard() - ) SkyblockHud.screenToOpen = new MapScreen(); + if (KeyBindings.map.isPressed() && LocationHandler.getCurrentLocation().getCategory().getMap() != null && SkyblockHud.hasSkyblockScoreboard()) SkyblockHud.screenToOpen = new MapScreen(); } public static class MapScreen extends GuiScreen { @@ -218,16 +151,7 @@ public class MapHandler { this.mc.renderEngine.bindTexture(map.mapTexture); float mapX = (width / 2f) - ((map.width / 2f) * map.scaleFactor); float mapY = (height / 2f) - ((map.height / 2f) * map.scaleFactor); - Gui.drawModalRectWithCustomSizedTexture( - (int) mapX, - (int) mapY, - 0, - 0, - (int) (map.width * map.scaleFactor), - (int) (map.height * map.scaleFactor), - (int) (map.width * map.scaleFactor), - (int) (map.height * map.scaleFactor) - ); + Gui.drawModalRectWithCustomSizedTexture((int) mapX, (int) mapY, 0, 0, (int) (map.width * map.scaleFactor), (int) (map.height * map.scaleFactor), (int) (map.width * map.scaleFactor), (int) (map.height * map.scaleFactor)); drawIcons((int) mapX, (int) mapY); if (this.mc.thePlayer != null && SkyblockHud.config.map.showPlayerLocation) { int x = this.mc.thePlayer.getPosition().getX() + map.xOffset; @@ -256,18 +180,7 @@ public class MapHandler { if (map.icons == null) return; for (MapIcon icon : map.icons) { if (!icon.canRender()) continue; - if ( - Utils.inRangeInclusive( - mouseX, - (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4, - (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + startX + 4 - ) && - Utils.inRangeInclusive( - mouseY, - (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + startY - 4, - (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + startY + 4 - ) - ) { + if (Utils.inRangeInclusive(mouseX, (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + startX - 4, (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + startX + 4) && Utils.inRangeInclusive(mouseY, (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + startY - 4, (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + startY + 4)) { drawHoveringText(Arrays.asList(icon.tooltip.split("\n")), mouseX, mouseY); break; } @@ -280,18 +193,7 @@ public class MapHandler { int mapY = (int) ((height / 2f) - ((map.height / 2f) * map.scaleFactor)); for (MapIcon icon : map.icons) { if (!icon.canRender()) continue; - if ( - Utils.inRangeInclusive( - mouseX, - (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + mapX - 4, - (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + mapX + 4 - ) && - Utils.inRangeInclusive( - mouseY, - (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + mapY - 4, - (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + mapY + 4 - ) - ) { + if (Utils.inRangeInclusive(mouseX, (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + mapX - 4, (int) ((icon.position.x + map.xOffset) * map.scaleFactor) + mapX + 4) && Utils.inRangeInclusive(mouseY, (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + mapY - 4, (int) ((icon.position.y + map.yOffset) * map.scaleFactor) + mapY + 4)) { if (!icon.command.isEmpty()) { this.mc.thePlayer.sendChatMessage("/" + icon.command); } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java index b25733b..fbb95eb 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java @@ -60,15 +60,7 @@ public class SlayerHandler { public void onSidebarPost(SidebarPostEvent event) { String arrayString = Arrays.toString(event.arrayScores); isDoingSlayer = Arrays.toString(event.arrayScores).contains("Slayer Quest"); - if ( - isDoingSlayer && - ( - currentSlayer.equals(slayerTypes.NONE) || - !arrayString - .replace(" ", "") - .contains(currentSlayer.getDisplayName().replace(" ", "") + Utils.intToRomanNumeral(slayerTier)) - ) - ) { + if (isDoingSlayer && (currentSlayer.equals(slayerTypes.NONE) || !arrayString.replace(" ", "").contains(currentSlayer.getDisplayName().replace(" ", "") + Utils.intToRomanNumeral(slayerTier)))) { for (int i = 0; i < event.scores.size(); i++) { String line = event.scores.get(i); if (line.contains("Slayer Quest") && event.scores.size() > 3) { @@ -81,8 +73,7 @@ public class SlayerHandler { } } SlayerHandler.currentSlayer = selectedSlayer; - SlayerHandler.slayerTier = - Utils.whatRomanNumeral(slayer.replace(selectedSlayer.getDisplayName().toLowerCase(), "").replace(" ", "")); + SlayerHandler.slayerTier = Utils.whatRomanNumeral(slayer.replace(selectedSlayer.getDisplayName().toLowerCase(), "").replace(" ", "")); break; } } @@ -118,9 +109,7 @@ public class SlayerHandler { progress = Integer.parseInt(xpMatcher.group(1)); } catch (Exception ignored) {} try { - maxKills = - Integer.parseInt(xpMatcher.group(2).replace("k", "")) * - (xpMatcher.group(2).contains("k") ? 1000 : xpMatcher.group(2).contains("m") ? 1000000 : 1); + maxKills = Integer.parseInt(xpMatcher.group(2).replace("k", "")) * (xpMatcher.group(2).contains("k") ? 1000 : xpMatcher.group(2).contains("m") ? 1000000 : 1); } catch (Exception ignored) {} } else if (line.contains("slay the boss")) { SlayerHandler.bossSlain = false; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java index 3ef4179..e599508 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/DwarvenIcons.java @@ -20,79 +20,20 @@ public class DwarvenIcons { } private static void setupNpcIcons() { - dwarvenIcons.add( - new MapHandler.MapIcon( - new Vector2f(129, 187), - new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"), - new ComponentBuilder() - .nl("Puzzler", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Puzzler gives you a small puzzle each day to solve and") - .nl("gives you 1000 mithril powder.") - .build(), - MapHandler.MapIconTypes.NPC - ) - ); + dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(129, 187), new ResourceLocation("skyblockhud", "maps/icons/puzzle.png"), new ComponentBuilder().nl("Puzzler", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Puzzler gives you a small puzzle each day to solve and").nl("gives you 1000 mithril powder.").build(), MapHandler.MapIconTypes.NPC)); } private static void setupMiscIcons() {} private static void setupInfoIcons() { - dwarvenIcons.add( - new MapHandler.MapIcon( - new Vector2f(129, 187), - new ResourceLocation("skyblockhud", "maps/icons/crown.png"), - new ComponentBuilder() - .nl("King", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The King allows you to first start commissions and if you click") - .nl("each king which change every skyblock day you will get") - .nl("the King Talisman.") - .nl() - .apd("Click to open HOTM", new char[] { '6', 'l' }) - .build(), - MapHandler.MapIconTypes.INFO, - "hotm" - ) - ); + dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(129, 187), new ResourceLocation("skyblockhud", "maps/icons/crown.png"), new ComponentBuilder().nl("King", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The King allows you to first start commissions and if you click").nl("each king which change every skyblock day you will get").nl("the King Talisman.").nl().apd("Click to open HOTM", new char[] { '6', 'l' }).build(), MapHandler.MapIconTypes.INFO, "hotm")); } private static void setupShopIcons() { - dwarvenIcons.add( - new MapHandler.MapIcon( - new Vector2f(4, 8), - new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), - new ComponentBuilder() - .nl("Forge", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Forge is where you can go craft special items") - .nl("and fuel your drill.") - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Forger - Allows you to forge special items") - .nl(" Jotraeline Greatforge - Allows you to refuel your drill.") - .nl() - .apd("Click to warp", new char[] { '6', 'l' }) - .build(), - MapHandler.MapIconTypes.SHOPS, - "warpforge" - ) - ); + dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(4, 8), new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), new ComponentBuilder().nl("Forge", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Forge is where you can go craft special items").nl("and fuel your drill.").nl("NPCS", new char[] { 'c', 'l' }).nl(" Forger - Allows you to forge special items").nl(" Jotraeline Greatforge - Allows you to refuel your drill.").nl().apd("Click to warp", new char[] { '6', 'l' }).build(), MapHandler.MapIconTypes.SHOPS, "warpforge")); } private static void setupQuestIcons() { - dwarvenIcons.add( - new MapHandler.MapIcon( - new Vector2f(67, 204), - new ResourceLocation("skyblockhud", "maps/icons/special.png"), - new ComponentBuilder() - .nl("Royal Resident", new char[] { 'a', 'l' }) - .nl("The Royal Resident is a quest where you right") - .nl("click them for a bit to obtain and if you continue") - .nl("to right click them for about 7 hours it will give") - .apd("the achievement Royal Conversation.") - .build(), - MapHandler.MapIconTypes.QUEST - ) - ); + dwarvenIcons.add(new MapHandler.MapIcon(new Vector2f(67, 204), new ResourceLocation("skyblockhud", "maps/icons/special.png"), new ComponentBuilder().nl("Royal Resident", new char[] { 'a', 'l' }).nl("The Royal Resident is a quest where you right").nl("click them for a bit to obtain and if you continue").nl("to right click them for about 7 hours it will give").apd("the achievement Royal Conversation.").build(), MapHandler.MapIconTypes.QUEST)); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java index 4539f35..443afb7 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/mapicons/HubIcons.java @@ -20,307 +20,36 @@ public class HubIcons { } private static void setupNpcIcons() { - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-2, -34), - new ResourceLocation("skyblockhud", "maps/icons/special.png"), - new ComponentBuilder() - .nl("Event Hut", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Event Hut is where special event npcs") - .nl("are during some events.") - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Baker - During New Years") - .nl(" Jerry - While Winter Island is opened") - .nl(" Fear Mongerer - During Spooky Festival") - .apd(" Oringo - During Traveling Zoo") - .build(), - MapHandler.MapIconTypes.NPC - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(135, 142), - new ResourceLocation("skyblockhud", "maps/icons/fairy.png"), - new ComponentBuilder() - .nl("Fairy", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Fairy is where you go when you find fairy souls") - .apd("to trade them in to get permanent stat upgrades.") - .build(), - MapHandler.MapIconTypes.NPC - ) - ); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-2, -34), new ResourceLocation("skyblockhud", "maps/icons/special.png"), new ComponentBuilder().nl("Event Hut", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Event Hut is where special event npcs").nl("are during some events.").nl("NPCS", new char[] { 'c', 'l' }).nl(" Baker - During New Years").nl(" Jerry - While Winter Island is opened").nl(" Fear Mongerer - During Spooky Festival").apd(" Oringo - During Traveling Zoo").build(), MapHandler.MapIconTypes.NPC)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(135, 142), new ResourceLocation("skyblockhud", "maps/icons/fairy.png"), new ComponentBuilder().nl("Fairy", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Fairy is where you go when you find fairy souls").apd("to trade them in to get permanent stat upgrades.").build(), MapHandler.MapIconTypes.NPC)); } private static void setupShopIcons() { - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-50, -22), - new ResourceLocation("skyblockhud", "maps/icons/building.png"), - new ComponentBuilder() - .nl("Builder's House", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Wool Weaver") - .nl(" Builder") - .apd(" Mad Redstone Engineer") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-78, -46), - new ResourceLocation("skyblockhud", "maps/icons/bar.png"), - new ComponentBuilder() - .nl("Tavern", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Bartender") - .nl(" Maddox the slayer") - .nl("Description", 'l') - .nl("The Tavern is where maddox the slayer is located you can") - .nl("start slayer quests with them to unlock") - .apd("new items the more slayer bosses you kill.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(36, -82), - new ResourceLocation("skyblockhud", "maps/icons/vet.png"), - new ComponentBuilder() - .nl("Vet", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Bea") - .nl(" Zog") - .nl(" Kat") - .nl(" George") - .nl("Description", 'l') - .nl("The Vet is where you go to upgrade your pet") - .nl("at Kat or to buy pet upgrade items from Zog") - .nl("or trade in your pet at George and if you're") - .apd("a new player you can buy a bee pet from Bea.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(58, -73), - new ResourceLocation("skyblockhud", "maps/icons/fishing_merchant.png"), - new ComponentBuilder() - .nl("Fishing Merchant", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Fishing Merchant allows you to buy") - .nl("fishing related items and he has his friend") - .nl("joe whose in the house hes setup") - .apd("in front of who sells sponges.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(46, -53), - new ResourceLocation("skyblockhud", "maps/icons/witch.png"), - new ComponentBuilder() - .nl("Alchemist", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Alchemist allows you to buy") - .apd("potion making related items") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-4, -128), - new ResourceLocation("skyblockhud", "maps/icons/metal_merchants.png"), - new ComponentBuilder() - .nl("Blacksmith Merchants", new char[] { 'a', 'l' }) - .nl("Merchants", new char[] { 'c', 'l' }) - .nl(" Weaponsmith - Weapon Related Items") - .nl(" Armorsmith - Armor Related Items") - .apd(" Mine Merchant - Mining Related Items") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-30, -120), - new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), - new ComponentBuilder() - .nl("Blacksmith", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Blacksmith") - .nl(" Dusk") - .nl(" Smithmonger") - .nl("Description", 'l') - .nl("The Blacksmith lets you reforge your items") - .nl("while the Smithmonger allows you to buy reforge stones") - .apd("and Dusk allows you to combine and apply runes.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(124, 180), - new ResourceLocation("skyblockhud", "maps/icons/dark_bar.png"), - new ComponentBuilder() - .nl("Dark Bar", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Shifty") - .nl(" Lucius") - .nl("Description", 'l') - .nl("The Dark Bar is where you can buy special") - .nl("brews from Shifty and you can buy special") - .nl("items from Lucius after buying a certain") - .apd("amount of items from the Dark Auction.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(92, 185), - new ResourceLocation("skyblockhud", "maps/icons/dark_ah.png"), - new ComponentBuilder() - .nl("Dark Auction", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Dark Auction allows you to buy") - .nl("super special items from Sirius the") - .apd("auctioneer in a special auction.") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-245, 52), - new ResourceLocation("skyblockhud", "maps/icons/scroll.png"), - new ComponentBuilder() - .nl("Lonely Philosopher", new char[] { 'a', 'l' }) - .nl("Shop", new char[] { '6', 'l' }) - .nl(" Travel Scroll to Hub Castle") - .nl() - .nl(" Cost") - .nl(" 150,000 Coins", '6') - .nl() - .apd(" Requires ") - .apd("MVP", 'b') - .apd("+", 'c') - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(24, -38), - new ResourceLocation("skyblockhud", "maps/icons/tux.png"), - new ComponentBuilder() - .nl("Fashion Shop", new char[] { 'a', 'l' }) - .nl("NPCS", new char[] { 'c', 'l' }) - .nl(" Wool Weaver") - .nl(" Builder") - .apd(" Mad Redstone Engineer") - .build(), - MapHandler.MapIconTypes.SHOPS - ) - ); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-50, -22), new ResourceLocation("skyblockhud", "maps/icons/building.png"), new ComponentBuilder().nl("Builder's House", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Wool Weaver").nl(" Builder").apd(" Mad Redstone Engineer").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-78, -46), new ResourceLocation("skyblockhud", "maps/icons/bar.png"), new ComponentBuilder().nl("Tavern", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Bartender").nl(" Maddox the slayer").nl("Description", 'l').nl("The Tavern is where maddox the slayer is located you can").nl("start slayer quests with them to unlock").apd("new items the more slayer bosses you kill.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(36, -82), new ResourceLocation("skyblockhud", "maps/icons/vet.png"), new ComponentBuilder().nl("Vet", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Bea").nl(" Zog").nl(" Kat").nl(" George").nl("Description", 'l').nl("The Vet is where you go to upgrade your pet").nl("at Kat or to buy pet upgrade items from Zog").nl("or trade in your pet at George and if you're").apd("a new player you can buy a bee pet from Bea.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(58, -73), new ResourceLocation("skyblockhud", "maps/icons/fishing_merchant.png"), new ComponentBuilder().nl("Fishing Merchant", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Fishing Merchant allows you to buy").nl("fishing related items and he has his friend").nl("joe whose in the house hes setup").apd("in front of who sells sponges.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(46, -53), new ResourceLocation("skyblockhud", "maps/icons/witch.png"), new ComponentBuilder().nl("Alchemist", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Alchemist allows you to buy").apd("potion making related items").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-4, -128), new ResourceLocation("skyblockhud", "maps/icons/metal_merchants.png"), new ComponentBuilder().nl("Blacksmith Merchants", new char[] { 'a', 'l' }).nl("Merchants", new char[] { 'c', 'l' }).nl(" Weaponsmith - Weapon Related Items").nl(" Armorsmith - Armor Related Items").apd(" Mine Merchant - Mining Related Items").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-30, -120), new ResourceLocation("skyblockhud", "maps/icons/blacksmith.png"), new ComponentBuilder().nl("Blacksmith", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Blacksmith").nl(" Dusk").nl(" Smithmonger").nl("Description", 'l').nl("The Blacksmith lets you reforge your items").nl("while the Smithmonger allows you to buy reforge stones").apd("and Dusk allows you to combine and apply runes.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(124, 180), new ResourceLocation("skyblockhud", "maps/icons/dark_bar.png"), new ComponentBuilder().nl("Dark Bar", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Shifty").nl(" Lucius").nl("Description", 'l').nl("The Dark Bar is where you can buy special").nl("brews from Shifty and you can buy special").nl("items from Lucius after buying a certain").apd("amount of items from the Dark Auction.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(92, 185), new ResourceLocation("skyblockhud", "maps/icons/dark_ah.png"), new ComponentBuilder().nl("Dark Auction", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Dark Auction allows you to buy").nl("super special items from Sirius the").apd("auctioneer in a special auction.").build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-245, 52), new ResourceLocation("skyblockhud", "maps/icons/scroll.png"), new ComponentBuilder().nl("Lonely Philosopher", new char[] { 'a', 'l' }).nl("Shop", new char[] { '6', 'l' }).nl(" Travel Scroll to Hub Castle").nl().nl(" Cost").nl(" 150,000 Coins", '6').nl().apd(" Requires ").apd("MVP", 'b').apd("+", 'c').build(), MapHandler.MapIconTypes.SHOPS)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(24, -38), new ResourceLocation("skyblockhud", "maps/icons/tux.png"), new ComponentBuilder().nl("Fashion Shop", new char[] { 'a', 'l' }).nl("NPCS", new char[] { 'c', 'l' }).nl(" Wool Weaver").nl(" Builder").apd(" Mad Redstone Engineer").build(), MapHandler.MapIconTypes.SHOPS)); } private static void setupMiscIcons() { - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-24, -53), - new ResourceLocation("skyblockhud", "maps/icons/bank.png"), - new ComponentBuilder() - .nl("Bank", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Bank is where you can store your money on skyblock") - .apd("you can also store some items in the vault.") - .build(), - MapHandler.MapIconTypes.MISC - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-26, -80), - new ResourceLocation("skyblockhud", "maps/icons/ah.png"), - new ComponentBuilder() - .nl("Auction House", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Auction House is where you can auction off your") - .apd("precious items in skyblock to make a profit.") - .build(), - MapHandler.MapIconTypes.MISC - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-38, -66), - new ResourceLocation("skyblockhud", "maps/icons/bazaar.png"), - new ComponentBuilder() - .nl("Bazaar", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Bazaar is where you can sell specific items") - .nl("on a sort of stock market and request and") - .apd("sell items at a specific price.") - .build(), - MapHandler.MapIconTypes.MISC - ) - ); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-24, -53), new ResourceLocation("skyblockhud", "maps/icons/bank.png"), new ComponentBuilder().nl("Bank", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Bank is where you can store your money on skyblock").apd("you can also store some items in the vault.").build(), MapHandler.MapIconTypes.MISC)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-26, -80), new ResourceLocation("skyblockhud", "maps/icons/ah.png"), new ComponentBuilder().nl("Auction House", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Auction House is where you can auction off your").apd("precious items in skyblock to make a profit.").build(), MapHandler.MapIconTypes.MISC)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-38, -66), new ResourceLocation("skyblockhud", "maps/icons/bazaar.png"), new ComponentBuilder().nl("Bazaar", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Bazaar is where you can sell specific items").nl("on a sort of stock market and request and").apd("sell items at a specific price.").build(), MapHandler.MapIconTypes.MISC)); } private static void setupInfoIcons() { - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(8, -95), - new ResourceLocation("skyblockhud", "maps/icons/community.png"), - new ComponentBuilder() - .nl("Community Center", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("The Community Center is where you can vote") - .nl("for your favorite election candidate,") - .nl("access the community shop, upgrade your") - .apd("account, and help with city projects.") - .build(), - MapHandler.MapIconTypes.INFO - ) - ); - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(150, 45), - new ResourceLocation("skyblockhud", "maps/icons/fishing.png"), - new ComponentBuilder() - .nl("Fisherman's Hut", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("This is a spot where people regularly") - .nl("do their fishing, this is one") - .apd("of many spots.") - .build(), - MapHandler.MapIconTypes.INFO - ) - ); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(8, -95), new ResourceLocation("skyblockhud", "maps/icons/community.png"), new ComponentBuilder().nl("Community Center", new char[] { 'a', 'l' }).nl("Description", 'l').nl("The Community Center is where you can vote").nl("for your favorite election candidate,").nl("access the community shop, upgrade your").apd("account, and help with city projects.").build(), MapHandler.MapIconTypes.INFO)); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(150, 45), new ResourceLocation("skyblockhud", "maps/icons/fishing.png"), new ComponentBuilder().nl("Fisherman's Hut", new char[] { 'a', 'l' }).nl("Description", 'l').nl("This is a spot where people regularly").nl("do their fishing, this is one").apd("of many spots.").build(), MapHandler.MapIconTypes.INFO)); } private static void setupQuestIcons() { - hubIcons.add( - new MapHandler.MapIcon( - new Vector2f(-8, -10), - new ResourceLocation("skyblockhud", "maps/icons/painter.png"), - new ComponentBuilder() - .nl("Marco", new char[] { 'a', 'l' }) - .nl("Description", 'l') - .nl("Marco is an NPC that has no other uses") - .nl("besides giving you a spray can for") - .apd("completing a quest.") - .build(), - MapHandler.MapIconTypes.QUEST - ) - ); + hubIcons.add(new MapHandler.MapIcon(new Vector2f(-8, -10), new ResourceLocation("skyblockhud", "maps/icons/painter.png"), new ComponentBuilder().nl("Marco", new char[] { 'a', 'l' }).nl("Description", 'l').nl("Marco is an NPC that has no other uses").nl("besides giving you a spray can for").apd("completing a quest.").build(), MapHandler.MapIconTypes.QUEST)); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java index a59b0db..afff109 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeHelper.java @@ -12,10 +12,7 @@ public class EntityTypeHelper { if (entity instanceof EntityEnderman) { EntityEnderman enderman = ((EntityEnderman) entity); double maxHealthBase = enderman.getAttributeMap().getAttributeInstanceByName("generic.maxHealth").getBaseValue(); - if ( - maxHealthBase == 13000d || - (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame)) - ) { + if (maxHealthBase == 13000d || (maxHealthBase == 2000d && enderman.getHeldBlockState().getBlock().equals(Blocks.end_portal_frame))) { return LocationHandler.getCurrentLocation().equals(Locations.DRAGONSNEST); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java index 83c6a70..40076d9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/sbentities/EntityTypeRegistry.java @@ -17,9 +17,7 @@ public class EntityTypeRegistry { public static String getEntityId(Entity entity) { if (!entities.containsKey(entity.getClass())) return null; - for (SkyBlockEntity skyBlockEntity : entities.get(entity.getClass())) if ( - skyBlockEntity.isEntity(entity) - ) return skyBlockEntity.getName(); + for (SkyBlockEntity skyBlockEntity : entities.get(entity.getClass())) if (skyBlockEntity.isEntity(entity)) return skyBlockEntity.getName(); return null; } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java index faec015..3b17899 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/DwarvenMineHandler.java @@ -72,8 +72,7 @@ public class DwarvenMineHandler { } else if (DwarvenMineHandler.currentEvent == Event.GOBLIN) { if (event.formattedLine.toLowerCase().contains("remaining:")) { try { - eventMax = - Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); + eventMax = Integer.parseInt(event.formattedLine.toLowerCase().replace("goblins", "").replace("remaining:", "").trim()); } catch (Exception ignored) {} } else if (event.formattedLine.toLowerCase().contains("your kills:") && !event.formattedLine.toLowerCase().contains("(")) { try { diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java index d16a3ac..2e2fae1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/IslandHandler.java @@ -28,10 +28,7 @@ public class IslandHandler { } public static boolean checkFlightDuration(String formatedScoreboardLine) { - if ( - LocationHandler.getCurrentLocation() == Locations.YOURISLAND && - Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("flight duration:") - ) { + if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND && Utils.removeColor(formatedScoreboardLine.toLowerCase().trim()).contains("flight duration:")) { String timeString = formatedScoreboardLine.toLowerCase().replace("flight duration:", "").replace(" ", ""); String[] times = timeString.split(":"); if (times.length == 2) { @@ -65,10 +62,7 @@ public class IslandHandler { if (LocationHandler.getCurrentLocation() == Locations.YOURISLAND) { if (formatedScoreboardLine.toLowerCase().contains("redstone:")) return true; try { - redstone = - formatedScoreboardLine.toLowerCase().contains("redstone:") - ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:")) - : 0; + redstone = formatedScoreboardLine.toLowerCase().contains("redstone:") ? Integer.parseInt(Utils.removeWhiteSpaceAndRemoveWord(formatedScoreboardLine, "redstone:")) : 0; } catch (Exception ignored) {} } return false; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java index 2204995..cc1edaf 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java @@ -19,12 +19,7 @@ public class MixinEntityArrow { @ModifyVariable(method = "onUpdate", at = @At(value = "STORE", ordinal = 1)) public MovingObjectPosition onUpdate(MovingObjectPosition position) { - if ( - position != null && - position.entityHit != null && - this.shootingEntity != null && - this.shootingEntity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID()) - ) { + if (position != null && position.entityHit != null && this.shootingEntity != null && this.shootingEntity.getUniqueID().equals(Minecraft.getMinecraft().thePlayer.getUniqueID())) { KillTrackerHandler.attackedEntities.add(position.entityHit.getUniqueID()); } return position; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java index c97a1f9..df36b8f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java @@ -44,17 +44,7 @@ public class MixinNetHandlerPlayClient { } */ - @Inject( - method = "handleTeams", - locals = LocalCapture.CAPTURE_FAILHARD, - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", - ordinal = 0, - shift = At.Shift.BEFORE - ), - cancellable = true - ) + @Inject(method = "handleTeams", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", ordinal = 0, shift = At.Shift.BEFORE), cancellable = true) public void handleTeams(S3EPacketTeams packetIn, CallbackInfo ci, Scoreboard scoreboard) { //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. if (scoreboard.getTeam(packetIn.getName()) != null && packetIn.getAction() == 0) ci.cancel(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java index 462896d..f8a2e0d 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/DungeonOverlay.java @@ -54,38 +54,18 @@ public class DungeonOverlay extends Gui { mc.renderEngine.bindTexture(GuiTextures.dungeon); drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 20 : 3), 16, 50, 3, 8); drawTexturedModalRect((width / 2) - 7, offset + (bossBarVisible ? 30 : 13), 19, 50, 3, 8); - String dungeonTimeElapsed = - (dungeonTimeMin > 9 ? String.valueOf(dungeonTimeMin) : "0" + dungeonTimeMin) + - ":" + - (dungeonTimeSec > 9 ? String.valueOf(dungeonTimeSec) : "0" + dungeonTimeSec); + String dungeonTimeElapsed = (dungeonTimeMin > 9 ? String.valueOf(dungeonTimeMin) : "0" + dungeonTimeMin) + ":" + (dungeonTimeSec > 9 ? String.valueOf(dungeonTimeSec) : "0" + dungeonTimeSec); drawCenteredString(font, dungeonTimeElapsed, (width / 2), offset + (bossBarVisible ? 40 : 23), 0xFFFF55); //KEYS - drawString( - font, - (DungeonHandler.hasBloodkey() ? "\u2714" : "x"), - (width / 2), - offset + (bossBarVisible ? 19 : 2), - (DungeonHandler.hasBloodkey() ? 0x55FF55 : 0xAA0000) - ); + drawString(font, (DungeonHandler.hasBloodkey() ? "\u2714" : "x"), (width / 2), offset + (bossBarVisible ? 19 : 2), (DungeonHandler.hasBloodkey() ? 0x55FF55 : 0xAA0000)); drawString(font, DungeonHandler.getWitherKeys() + "x", (width / 2), offset + (bossBarVisible ? 30 : 13), 0x555555); //CLEARED PERCENTAGE GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); int clearPercent = DungeonHandler.getDungeonCleared(); - String clearPercentage = - "Dungeon Cleared: \u00A7" + - (clearPercent <= 20 ? "4" : clearPercent <= 50 ? "6" : clearPercent <= 80 ? "e" : "a") + - clearPercent + - "%"; + String clearPercentage = "Dungeon Cleared: \u00A7" + (clearPercent <= 20 ? "4" : clearPercent <= 50 ? "6" : clearPercent <= 80 ? "e" : "a") + clearPercent + "%"; drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(clearPercentage) + 3, 14); - drawTexturedModalRect( - ((width / 2) + 17) + font.getStringWidth(clearPercentage) + 3, - offset + (bossBarVisible ? 20 : 3), - 252, - 34, - 4, - 14 - ); + drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(clearPercentage) + 3, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); drawString(font, clearPercentage, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); //DEATHS @@ -105,14 +85,7 @@ public class DungeonOverlay extends Gui { int totalSecrets = DungeonHandler.getTotalSecrets(); String secretsText = "Secrets: " + secrets + "/" + maxSecrets + " (" + totalSecrets + ")"; drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(secretsText)) - 4, offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 17 - (font.getStringWidth(secretsText))) - 2, - offset + (bossBarVisible ? 20 : 3), - 2, - 34, - font.getStringWidth(secretsText) + 2, - 14 - ); + drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(secretsText))) - 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(secretsText) + 2, 14); drawString(font, secretsText, (width / 2) - 17 - (font.getStringWidth(secretsText)), offset + (bossBarVisible ? 23 : 6), 0xAAAAAA); //CRYPTS @@ -121,14 +94,7 @@ public class DungeonOverlay extends Gui { int crypts = DungeonHandler.getCrypts(); String cryptText = "Crypts: " + crypts; drawTexturedModalRect((width / 2) - 17 - (font.getStringWidth(cryptText)) - 4, offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 17 - (font.getStringWidth(cryptText))) - 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(cryptText) + 2, - 14 - ); + drawTexturedModalRect(((width / 2) - 17 - (font.getStringWidth(cryptText))) - 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(cryptText) + 2, 14); drawString(font, cryptText, (width / 2) - 17 - (font.getStringWidth(cryptText)), offset + (bossBarVisible ? 38 : 21), 0xAAAAAA); } @@ -141,29 +107,14 @@ public class DungeonOverlay extends Gui { int x = position.getAbsX(resolution, 182); int y = position.getAbsY(resolution, 5); - GenericOverlays.drawLargeBar( - mc, - x - 91, - y, - percentage, - 0.999f, - SpecialColour.specialToChromaRGB(dungeonHud.barLoadColor), - SpecialColour.specialToChromaRGB(dungeonHud.barFullColor), - dungeonHud.barStyle - ); + GenericOverlays.drawLargeBar(mc, x - 91, y, percentage, 0.999f, SpecialColour.specialToChromaRGB(dungeonHud.barLoadColor), SpecialColour.specialToChromaRGB(dungeonHud.barFullColor), dungeonHud.barStyle); } } @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getMinecraft(); - if ( - Utils.overlayShouldRender( - event.type, - SkyblockHud.hasSkyblockScoreboard(), - LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS) - ) - ) { + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS))) { bossBarVisible = BossStatus.statusBarTime > 0 && GuiIngameForge.renderBossHealth && BossbarHandler.bossBarRendered; GlStateManager.enableBlend(); drawUltimateBar(mc, event.resolution); @@ -171,12 +122,7 @@ public class DungeonOverlay extends Gui { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (!SkyblockHud.config.dungeon.hideDungeonPlayers) { int[] hardCodedPos = new int[] { 5, 42, 79, 116 }; - Position[] positions = new Position[] { - SkyblockHud.config.dungeon.dungeonPlayer1, - SkyblockHud.config.dungeon.dungeonPlayer2, - SkyblockHud.config.dungeon.dungeonPlayer3, - SkyblockHud.config.dungeon.dungeonPlayer4 - }; + Position[] positions = new Position[] { SkyblockHud.config.dungeon.dungeonPlayer1, SkyblockHud.config.dungeon.dungeonPlayer2, SkyblockHud.config.dungeon.dungeonPlayer3, SkyblockHud.config.dungeon.dungeonPlayer4 }; for (int i = 0; i < Math.min(DungeonHandler.getDungeonPlayers().values().size(), 4); i++) { DungeonPlayer player = (DungeonPlayer) DungeonHandler.getDungeonPlayers().values().toArray()[i]; int posX; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java index 439d857..eeb48e1 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/GenericOverlays.java @@ -10,16 +10,7 @@ import net.minecraft.client.renderer.GlStateManager; public class GenericOverlays extends Gui { - public static void drawLargeBar( - Minecraft mc, - int x, - int y, - float percentage, - float max, - int fullColor, - int loadingColor, - int barStyle - ) { + public static void drawLargeBar(Minecraft mc, int x, int y, float percentage, float max, int fullColor, int loadingColor, int barStyle) { if (SkyblockHud.hasSkyblockScoreboard()) { mc.renderEngine.bindTexture(GuiTextures.bars); Color color = new Color(percentage == max ? fullColor : loadingColor); @@ -34,16 +25,7 @@ public class GenericOverlays extends Gui { } } - public static void drawSmallBar( - Minecraft mc, - int x, - int y, - double percentage, - double max, - int fullColor, - int loadingColor, - int barStyle - ) { + public static void drawSmallBar(Minecraft mc, int x, int y, double percentage, double max, int fullColor, int loadingColor, int barStyle) { if (SkyblockHud.hasSkyblockScoreboard()) { mc.renderEngine.bindTexture(GuiTextures.bars); Color color = new Color(percentage == max ? fullColor : loadingColor); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java index 530a890..23b9df0 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/OverlayHud.java @@ -42,24 +42,11 @@ public class OverlayHud extends Gui { timeMin = timeMin - (timeHour * 60); String militaryTime = timeHour + ":" + (timeMin == 0 ? timeMin + "0" : timeMin); int time12Hour = timeHour >= 12 ? timeHour - 12 : timeHour; - String normalTime = - (time12Hour == 0 ? "00" : String.valueOf(time12Hour)) + ":" + (timeMin == 0 ? "00" : timeMin) + (timeHour >= 12 ? "pm" : "am"); + String normalTime = (time12Hour == 0 ? "00" : String.valueOf(time12Hour)) + ":" + (timeMin == 0 ? "00" : timeMin) + (timeHour >= 12 ? "pm" : "am"); drawTexturedModalRect((width / 2) - 17, offset + (bossBarVisible ? 17 : 0), 0, 0, 34, 34); drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 24 : 7), (timeHour > 19 || timeHour < 4) ? 43 : 43 + 8, 0, 8, 8); - if (SkyblockHud.config.main.twelveHourClock) drawScaledString( - 0.8f, - width / 2, - offset + (bossBarVisible ? 38 : 21), - normalTime, - (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55 - ); else drawCenteredString( - font, - militaryTime, - (width / 2), - offset + (bossBarVisible ? 38 : 21), - (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55 - ); + if (SkyblockHud.config.main.twelveHourClock) drawScaledString(0.8f, width / 2, offset + (bossBarVisible ? 38 : 21), normalTime, (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55); else drawCenteredString(font, militaryTime, (width / 2), offset + (bossBarVisible ? 38 : 21), (timeHour > 19 || timeHour < 4) ? 0xAFB8CC : 0xFFFF55); //PURSE drawPurseAndBits(width, offset, mc); @@ -100,26 +87,10 @@ public class OverlayHud extends Gui { if (mc.thePlayer.ticksExisted % 600 == 0) eventToggle = true; mc.renderEngine.bindTexture(GuiTextures.overlay); String dateText = SeasonDateHandler.getFancySeasonAndDate(); - if ( - eventToggle && !SeasonDateHandler.getCurrentEvent().isEmpty() && !SeasonDateHandler.getCurrentEventTime().isEmpty() - ) dateText = SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); + if (eventToggle && !SeasonDateHandler.getCurrentEvent().isEmpty() && !SeasonDateHandler.getCurrentEventTime().isEmpty()) dateText = SeasonDateHandler.getCurrentEvent().trim() + " " + SeasonDateHandler.getCurrentEventTime().trim(); drawTexturedModalRect((width / 2) + 17, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(dateText) + 9, 14); - drawTexturedModalRect( - ((width / 2) + 17) + font.getStringWidth(dateText) + 9, - offset + (bossBarVisible ? 20 : 3), - 252, - 34, - 4, - 14 - ); - drawTexturedModalRect( - ((width / 2) + 17) + font.getStringWidth(dateText) + 2, - offset + (bossBarVisible ? 23 : 6), - SeasonDateHandler.getCurrentSeason().getTextureX(), - 16, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 9, offset + (bossBarVisible ? 20 : 3), 252, 34, 4, 14); + drawTexturedModalRect(((width / 2) + 17) + font.getStringWidth(dateText) + 2, offset + (bossBarVisible ? 23 : 6), SeasonDateHandler.getCurrentSeason().getTextureX(), 16, 8, 8); drawString(font, dateText, (width / 2) + 18, offset + (bossBarVisible ? 23 : 6), 0xffffff); } } @@ -127,55 +98,20 @@ public class OverlayHud extends Gui { public void drawLocation(int width, int offset, Minecraft mc) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), - offset + (bossBarVisible ? 20 : 3), - 0, - 34, - 2, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 2, - offset + (bossBarVisible ? 20 : 3), - 2, - 34, - font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 4, - offset + (bossBarVisible ? 23 : 6), - LocationHandler.getCurrentLocation().getCategory().getTexturePos(), - 8, - 8, - 8 - ); - drawString( - font, - LocationHandler.getCurrentLocation().getDisplayName(), - (width / 2) - 19 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), - offset + (bossBarVisible ? 23 : 6), - 0xFFFFFF - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 20 : 3), 0, 34, 2, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 2, offset + (bossBarVisible ? 20 : 3), 2, 34, font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName()))) + 4, offset + (bossBarVisible ? 23 : 6), LocationHandler.getCurrentLocation().getCategory().getTexturePos(), 8, 8, 8); + drawString(font, LocationHandler.getCurrentLocation().getDisplayName(), (width / 2) - 19 - (font.getStringWidth(LocationHandler.getCurrentLocation().getDisplayName())), offset + (bossBarVisible ? 23 : 6), 0xFFFFFF); } public void drawRedstone(int width, int offset, Minecraft mc) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); - int redstoneColor = IslandHandler.redstone > 90 - ? 0xFF0000 - : IslandHandler.redstone > 75 ? 0xC45B00 : IslandHandler.redstone > 50 ? 0xFFFF55 : 0x55FF55; + int redstoneColor = IslandHandler.redstone > 90 ? 0xFF0000 : IslandHandler.redstone > 75 ? 0xC45B00 : IslandHandler.redstone > 50 ? 0xFFFF55 : 0x55FF55; if (IslandHandler.redstone > 0 && Utils.isPlayerHoldingRedstone(mc.thePlayer)) { drawTexturedModalRect((width / 2) - 15, offset + (bossBarVisible ? 51 : 34), 0, 48, 30, 18); drawTexturedModalRect((width / 2) - 4, offset + (bossBarVisible ? 51 : 34), 59, 0, 8, 8); - drawCenteredString( - mc.fontRendererObj, - IslandHandler.redstone + "%", - (width / 2), - offset + (bossBarVisible ? 58 : 41), - redstoneColor - ); + drawCenteredString(mc.fontRendererObj, IslandHandler.redstone + "%", (width / 2), offset + (bossBarVisible ? 58 : 41), redstoneColor); } } @@ -185,14 +121,7 @@ public class OverlayHud extends Gui { int xPos = (width / 2) + 17; //COINS - drawTexturedModalRect( - xPos, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11, - 14 - ); + drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getCoinsFormatted()) + 11, 14); drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 34, 0, 8, 8); drawString(font, CurrencyHandler.getCoinsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0xFFAA00); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -201,14 +130,7 @@ public class OverlayHud extends Gui { //BITS if (CurrencyHandler.getBits() > 0) { - drawTexturedModalRect( - xPos, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11, - 14 - ); + drawTexturedModalRect(xPos, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(CurrencyHandler.getBitsFormatted()) + 11, 14); drawTexturedModalRect(xPos + 1, offset + (bossBarVisible ? 37 : 20), 75, 0, 8, 8); drawString(font, CurrencyHandler.getBitsFormatted(), xPos + 10, offset + (bossBarVisible ? 38 : 21), 0x55FFFF); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -224,32 +146,11 @@ public class OverlayHud extends Gui { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); DecimalFormat flightFormat = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.CANADA)); String duration; - if (IslandHandler.flightTime < 60) duration = IslandHandler.flightTime + "s"; else if ( - IslandHandler.flightTime < 3600 - ) duration = flightFormat.format((double) IslandHandler.flightTime / 60) + "m"; else if ( - IslandHandler.flightTime < 86400 - ) duration = flightFormat.format((double) IslandHandler.flightTime / 3600) + "hr"; else if ( - IslandHandler.flightTime < 86460 - ) duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "day"; else duration = - flightFormat.format((double) IslandHandler.flightTime / 86400) + "days"; + if (IslandHandler.flightTime < 60) duration = IslandHandler.flightTime + "s"; else if (IslandHandler.flightTime < 3600) duration = flightFormat.format((double) IslandHandler.flightTime / 60) + "m"; else if (IslandHandler.flightTime < 86400) duration = flightFormat.format((double) IslandHandler.flightTime / 3600) + "hr"; else if (IslandHandler.flightTime < 86460) duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "day"; else duration = flightFormat.format((double) IslandHandler.flightTime / 86400) + "days"; mc.renderEngine.bindTexture(GuiTextures.overlay); drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(duration) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 4, - offset + (bossBarVisible ? 38 : 21), - 67, - 0, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), 67, 0, 8, 8); drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -260,22 +161,8 @@ public class OverlayHud extends Gui { mc.renderEngine.bindTexture(GuiTextures.overlay); String duration = "Rain: " + ParkIslandHandler.getRainTime(); drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(duration) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 4, - offset + (bossBarVisible ? 38 : 21), - 83, - 0, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), 83, 0, 8, 8); drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -312,22 +199,8 @@ public class OverlayHud extends Gui { } String text = stringBuilder.toString(); drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(text))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(text) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(text))) + 4, - offset + (bossBarVisible ? 38 : 21), - slayerType.getX(), - 24, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(text) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 4, offset + (bossBarVisible ? 38 : 21), slayerType.getX(), 24, 8, 8); drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -339,22 +212,8 @@ public class OverlayHud extends Gui { mc.renderEngine.bindTexture(GuiTextures.overlay); String mithril = DwarvenMineHandler.getMithrilFormatted(); drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(mithril) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, - offset + (bossBarVisible ? 38 : 21), - 91, - 0, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(mithril) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(mithril))) + 4, offset + (bossBarVisible ? 38 : 21), 91, 0, 8, 8); drawString(font, mithril, (width / 2) - 19 - (font.getStringWidth(mithril)), offset + (bossBarVisible ? 38 : 21), 0x00C896); } } @@ -363,26 +222,10 @@ public class OverlayHud extends Gui { if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(GuiTextures.overlay); - String duration = FarmingIslandHandler.location != Locations.NONE - ? FarmingIslandHandler.location.getDisplayName() - : "" + FarmingIslandHandler.pelts; + String duration = FarmingIslandHandler.location != Locations.NONE ? FarmingIslandHandler.location.getDisplayName() : "" + FarmingIslandHandler.pelts; drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(duration) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 4, - offset + (bossBarVisible ? 38 : 21), - FarmingIslandHandler.location != Locations.NONE ? 123 : 115, - 0, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), FarmingIslandHandler.location != Locations.NONE ? 123 : 115, 0, 8, 8); drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } @@ -393,56 +236,15 @@ public class OverlayHud extends Gui { mc.renderEngine.bindTexture(GuiTextures.overlay); if (DwarvenMineHandler.eventMax > 0) { String duration = DwarvenMineHandler.eventProgress + "/" + DwarvenMineHandler.eventMax; - drawTexturedModalRect( - (width / 2) - 33 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 35 : 18), - 0, - 34, - 2, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(duration) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(duration))) + 4, - offset + (bossBarVisible ? 38 : 21), - DwarvenMineHandler.currentEvent.x, - 0, - 8, - 8 - ); - drawString( - font, - duration, - (width / 2) - 19 - (font.getStringWidth(duration)), - offset + (bossBarVisible ? 38 : 21), - 0xFFFFFF - ); + drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(duration) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(duration))) + 4, offset + (bossBarVisible ? 38 : 21), DwarvenMineHandler.currentEvent.x, 0, 8, 8); + drawString(font, duration, (width / 2) - 19 - (font.getStringWidth(duration)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } else { String text = DwarvenMineHandler.currentEvent.displayName; drawTexturedModalRect((width / 2) - 33 - (font.getStringWidth(text)), offset + (bossBarVisible ? 35 : 18), 0, 34, 2, 14); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(text))) + 2, - offset + (bossBarVisible ? 35 : 18), - 2, - 34, - font.getStringWidth(text) + 14, - 14 - ); - drawTexturedModalRect( - ((width / 2) - 33 - (font.getStringWidth(text))) + 4, - offset + (bossBarVisible ? 38 : 21), - DwarvenMineHandler.currentEvent.x, - 0, - 8, - 8 - ); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 2, offset + (bossBarVisible ? 35 : 18), 2, 34, font.getStringWidth(text) + 14, 14); + drawTexturedModalRect(((width / 2) - 33 - (font.getStringWidth(text))) + 4, offset + (bossBarVisible ? 38 : 21), DwarvenMineHandler.currentEvent.x, 0, 8, 8); drawString(font, text, (width / 2) - 19 - (font.getStringWidth(text)), offset + (bossBarVisible ? 38 : 21), 0xFFFFFF); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java index 7c622e4..d6a9709 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/overlay/RPGHud.java @@ -52,14 +52,7 @@ public class RPGHud extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { - if ( - Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.renderer.hideXpBar) - ) MinecraftForge.EVENT_BUS.post( - new RenderGameOverlayEvent.Post( - new RenderGameOverlayEvent(event.partialTicks, event.resolution), - RenderGameOverlayEvent.ElementType.EXPERIENCE - ) - ); + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.renderer.hideXpBar)) MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(event.partialTicks, event.resolution), RenderGameOverlayEvent.ElementType.EXPERIENCE)); if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), SkyblockHud.config.rpg.showRpgHud)) { Minecraft mc = Minecraft.getMinecraft(); GlStateManager.enableBlend(); @@ -101,22 +94,10 @@ public class RPGHud extends Gui { drawTexturedModalRect(rightAligned ? x + 19 : 41 + x, 33 + y, rightAligned ? 196 : 0, 88, (int) airWidth, 4); } GlStateManager.scale(0.75f, 0.75f, 1); - drawCenteredString( - mc.fontRendererObj, - "" + mc.thePlayer.experienceLevel, - (rightAligned ? 130 : 0) + (int) (15 + x / 0.75f), - (int) (45 + y / 0.75f), - 8453920 - ); + drawCenteredString(mc.fontRendererObj, "" + mc.thePlayer.experienceLevel, (rightAligned ? 130 : 0) + (int) (15 + x / 0.75f), (int) (45 + y / 0.75f), 8453920); GlStateManager.scale(1 / 0.75f, 1 / 0.75f, 1); GlStateManager.scale(0.75f, 0.75f, 1); - font.drawString( - ChatFormatting.RED + " \u2764 " + health + "/" + maxHealth, - (rightAligned ? -40 : 0) + (int) (64 + x / 0.75f), - (int) (8 + y / 0.75f), - 0xffffff, - true - ); + font.drawString(ChatFormatting.RED + " \u2764 " + health + "/" + maxHealth, (rightAligned ? -40 : 0) + (int) (64 + x / 0.75f), (int) (8 + y / 0.75f), 0xffffff, true); GlStateManager.scale(1 / 0.75f, 1 / 0.75f, 1); GlStateManager.color(255, 255, 255); GlStateManager.disableBlend(); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java index 1fc9a77..4e895f9 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java @@ -24,9 +24,7 @@ public class ActionBarParsing { private static final Pattern ManaRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E Mana"); private static final Pattern ManaOverflowRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC"); private static final Pattern ManaDecreaseRegex = Pattern.compile("-([0-9]+) Mana \\("); - private static final Pattern XpGainRegex = Pattern.compile( - "\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting) \\((\\d*\\.?\\d*)%\\)" - ); + private static final Pattern XpGainRegex = Pattern.compile("\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting) \\((\\d*\\.?\\d*)%\\)"); private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764"); private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]"); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java index b794eda..bc36b70 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/seasons/SeasonDateHandler.java @@ -15,10 +15,7 @@ public class SeasonDateHandler { @SubscribeEvent public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { if (Season.get(SeasonDateHandler.removeDate(event.formattedLine.toLowerCase()).toUpperCase()) != Season.ERROR) { - SeasonDateHandler.setCurrentDateAndSeason( - SeasonDateHandler.removeSeason(Utils.removeColor(event.formattedLine.toLowerCase().trim())), - SeasonDateHandler.removeDate(Utils.removeColor(event.formattedLine.toLowerCase().trim())).toUpperCase() - ); + SeasonDateHandler.setCurrentDateAndSeason(SeasonDateHandler.removeSeason(Utils.removeColor(event.formattedLine.toLowerCase().trim())), SeasonDateHandler.removeDate(Utils.removeColor(event.formattedLine.toLowerCase().trim())).toUpperCase()); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java index 8f0608d..5d5615f 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java @@ -26,47 +26,21 @@ public class KillTrackerHandler { public void onDeath(LivingDeathEvent event) { if (false) { //Used for testing - System.out.println( - "----------------------------------------------------------------------------------------------------------------" - ); + System.out.println("----------------------------------------------------------------------------------------------------------------"); System.out.println("Name : " + event.entity.getName()); System.out.println("UUID : " + event.entity.getUniqueID()); NBTTagCompound tag = new NBTTagCompound(); event.entity.writeToNBT(tag); System.out.println("Tag : " + tag); System.out.println("Damage : " + getDamageSourceString(event.source)); - System.out.println( - "----------------------------------------------------------------------------------------------------------------" - ); + System.out.println("----------------------------------------------------------------------------------------------------------------"); } attackedEntities.remove(event.entity.getUniqueID()); } public static String getDamageSourceString(DamageSource source) { - return ( - "{ " + - source.getDamageType() + - ", " + - source.isDamageAbsolute() + - ", " + - source.isDifficultyScaled() + - ", " + - source.isFireDamage() + - ", " + - source.isProjectile() + - ", " + - source.isUnblockable() + - ", " + - source.isExplosion() + - ", " + - source.isMagicDamage() + - ", " + - source.isCreativePlayer() + - ", " + - source.getSourceOfDamage() + - " }" - ); + return ("{ " + source.getDamageType() + ", " + source.isDamageAbsolute() + ", " + source.isDifficultyScaled() + ", " + source.isFireDamage() + ", " + source.isProjectile() + ", " + source.isUnblockable() + ", " + source.isExplosion() + ", " + source.isMagicDamage() + ", " + source.isCreativePlayer() + ", " + source.getSourceOfDamage() + " }"); } @SubscribeEvent diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java index 858770a..624ca60 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java @@ -78,10 +78,7 @@ public class TrackerFileLoader { TrackerHandler.trackers.putIfAbsent(location, new TrackerHandler.TrackerData(events)); } - tracker - .get("location") - .getAsJsonArray() - .forEach(loc -> TrackerHandler.trackerIds.put(Locations.get(loc.getAsString()), location)); + tracker.get("location").getAsJsonArray().forEach(loc -> TrackerHandler.trackerIds.put(Locations.get(loc.getAsString()), location)); } } @@ -127,9 +124,7 @@ public class TrackerFileLoader { return true; } - 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))) { JsonObject json = gson.fromJson(reader, JsonObject.class); if (json.has("trackerStats")) { json @@ -169,9 +164,7 @@ public class TrackerFileLoader { 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))) { JsonObject json = new JsonObject(); json.add("trackerStats", getTrackerFile()); writer.write(gson.toJson(json)); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java index f0a5b90..fa2bacf 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java @@ -82,14 +82,7 @@ public class TrackerHandler { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { - if ( - Utils.overlayShouldRender( - event.type, - SkyblockHud.hasSkyblockScoreboard(), - trackerIds.containsKey(LocationHandler.getCurrentLocation()), - !SkyblockHud.config.trackers.hideTracker - ) - ) { + if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackerIds.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { String trackerId = trackerIds.get(LocationHandler.getCurrentLocation()); Minecraft mc = Minecraft.getMinecraft(); TrackerData tracked = trackers.get(trackerId); @@ -103,13 +96,7 @@ public class TrackerHandler { Gui.drawRect(startPos, y, startPos + 120, y + 10, -1072689136); mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); y += 10; - Gui.drawRect( - startPos, - y, - startPos + (tracker.size() >= 6 ? 120 : tracker.size() * 20), - (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), - 1610612736 - ); + Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 120 : tracker.size() * 20), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); int x = startPos; for (ItemStack stack : tracker.values()) { String s = String.valueOf(stack.stackSize); @@ -118,12 +105,7 @@ public class TrackerHandler { drawItemStack(stack, x, y); GlStateManager.disableDepth(); GlStateManager.disableBlend(); - mc.fontRendererObj.drawStringWithShadow( - s, - (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), - (float) (y + 9), - stack.stackSize < 1 ? 16733525 : 16777215 - ); + mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), stack.stackSize < 1 ? 16733525 : 16777215); GlStateManager.enableBlend(); GlStateManager.enableDepth(); |