diff options
| author | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:24:20 -0400 |
|---|---|---|
| committer | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:24:20 -0400 |
| commit | 98ee5a2ae8090c061b1e61e7955d793416991822 (patch) | |
| tree | e34bb84ed247f08f2931f10d1dfbf6c8b883004c /src/main/java/com | |
| parent | c04ca523f9fb9f7adefa74587db61f76deeae9f0 (diff) | |
| download | skyblockhud-98ee5a2ae8090c061b1e61e7955d793416991822.tar.gz skyblockhud-98ee5a2ae8090c061b1e61e7955d793416991822.tar.bz2 skyblockhud-98ee5a2ae8090c061b1e61e7955d793416991822.zip | |
140?
Diffstat (limited to 'src/main/java/com')
38 files changed, 200 insertions, 980 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java index 0f4713f..ad7b1e8 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/ComponentHandler.java @@ -33,8 +33,7 @@ public class ComponentHandler { boolean eventPass = false; if (mc.theWorld != null) { List<NetworkPlayerInfo> players = sortingList.sortedCopy(mc.thePlayer.sendQueue.getPlayerInfoMap()); - GuiIngameForge.renderObjective = - !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; + GuiIngameForge.renderObjective = !SkyblockHud.hasSkyblockScoreboard() || !SkyblockHud.config.misc.hideScoreboard; if (players != null && SkyblockHud.hasSkyblockScoreboard()) { if (ticksExisted % 60 == 0) { for (NetworkPlayerInfo player : players) { @@ -43,33 +42,24 @@ public class ComponentHandler { .matcher(Utils.removeColor(player.getDisplayName().getFormattedText())) .replaceAll(""); if (LocationHandler.getCurrentLocation().equals(Locations.CATACOMBS)) { - if ( - formattedTabListPlayer.toLowerCase().contains("secrets found:") - ) DungeonHandler.parseTotalSecrets(formattedTabListPlayer); - if ( - formattedTabListPlayer.toLowerCase().contains("deaths:") - ) DungeonHandler.parseDeaths(formattedTabListPlayer); - if ( - formattedTabListPlayer.toLowerCase().contains("crypts:") - ) DungeonHandler.parseCrypts(formattedTabListPlayer); - } else if ( - LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES) - ) { + if (formattedTabListPlayer.toLowerCase().contains("secrets found:")) DungeonHandler.parseTotalSecrets( + formattedTabListPlayer + ); + if (formattedTabListPlayer.toLowerCase().contains("deaths:")) DungeonHandler.parseDeaths( + formattedTabListPlayer + ); + if (formattedTabListPlayer.toLowerCase().contains("crypts:")) DungeonHandler.parseCrypts( + formattedTabListPlayer + ); + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.DWARVENMINES)) { if (formattedTabListPlayer.toLowerCase().contains("mithril powder:")) { DwarvenMineHandler.parseMithril(formattedTabListPlayer); } - } else if ( - LocationHandler - .getCurrentLocation() - .getCategory() - .equals(LocationCategory.MUSHROOMDESERT) - ) { + } else if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.MUSHROOMDESERT)) { if (formattedTabListPlayer.toLowerCase().contains("pelts:")) { try { FarmingIslandHandler.pelts = - Integer.parseInt( - formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim() - ); + Integer.parseInt(formattedTabListPlayer.toLowerCase().replace("pelts:", "").trim()); } catch (Exception ignored) {} } } @@ -85,16 +75,9 @@ public class ComponentHandler { if (i < 80) { if (players.get(i + 1).getDisplayName() != null) { String secondLine = SCOREBOARD_CHARACTERS - .matcher( - Utils.removeColor( - players.get(i + 1).getDisplayName().getFormattedText() - ) - ) + .matcher(Utils.removeColor(players.get(i + 1).getDisplayName().getFormattedText())) .replaceAll(""); - SeasonDateHandler.setCurrentEvent( - formattedTabListPlayer.replace("Event:", ""), - secondLine - ); + SeasonDateHandler.setCurrentEvent(formattedTabListPlayer.replace("Event:", ""), secondLine); eventPass = true; } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java b/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java index af6b49c..9198433 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/GuiTextures.java @@ -20,27 +20,13 @@ public class GuiTextures { public static final ResourceLocation THREE = new ResourceLocation("skyblockhud:core/toggle_3.png"); public static final ResourceLocation ON = new ResourceLocation("skyblockhud:core/toggle_on.png"); - public static final ResourceLocation slider_off_cap = new ResourceLocation( - "skyblockhud:core/slider/slider_off_cap.png" - ); - public static final ResourceLocation slider_off_notch = new ResourceLocation( - "skyblockhud:core/slider/slider_off_notch.png" - ); - public static final ResourceLocation slider_off_segment = new ResourceLocation( - "skyblockhud:core/slider/slider_off_segment.png" - ); - public static final ResourceLocation slider_on_cap = new ResourceLocation( - "skyblockhud:core/slider/slider_on_cap.png" - ); - public static final ResourceLocation slider_on_notch = new ResourceLocation( - "skyblockhud:core/slider/slider_on_notch.png" - ); - public static final ResourceLocation slider_on_segment = new ResourceLocation( - "skyblockhud:core/slider/slider_on_segment.png" - ); - public static final ResourceLocation slider_button_new = new ResourceLocation( - "skyblockhud:core/slider/slider_button.png" - ); + public static final ResourceLocation slider_off_cap = new ResourceLocation("skyblockhud:core/slider/slider_off_cap.png"); + public static final ResourceLocation slider_off_notch = new ResourceLocation("skyblockhud:core/slider/slider_off_notch.png"); + public static final ResourceLocation slider_off_segment = new ResourceLocation("skyblockhud:core/slider/slider_off_segment.png"); + public static final ResourceLocation slider_on_cap = new ResourceLocation("skyblockhud:core/slider/slider_on_cap.png"); + public static final ResourceLocation slider_on_notch = new ResourceLocation("skyblockhud:core/slider/slider_on_notch.png"); + public static final ResourceLocation slider_on_segment = new ResourceLocation("skyblockhud:core/slider/slider_on_segment.png"); + public static final ResourceLocation slider_button_new = new ResourceLocation("skyblockhud:core/slider/slider_button.png"); public static final ResourceLocation overlay = new ResourceLocation("skyblockhud", "stats.png"); public static final ResourceLocation dungeon = new ResourceLocation("skyblockhud", "dungeon.png"); diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java index 8cd8baf..071d120 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java @@ -51,10 +51,7 @@ public class SkyblockHud { private File configFile; - private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet( - "SKYBLOCK", - "\u7A7A\u5C9B\u751F\u5B58" - ); + private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58"); private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); @@ -90,9 +87,7 @@ public class SkyblockHud { if (configFile.exists()) { try ( - BufferedReader reader = new BufferedReader( - new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8)) ) { config = gson.fromJson(reader, SBHConfig.class); } catch (Exception ignored) {} @@ -114,9 +109,7 @@ public class SkyblockHud { configFile.createNewFile(); try ( - BufferedWriter writer = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8) - ) + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8)) ) { writer.write(gson.toJson(config)); } @@ -181,13 +174,7 @@ public class SkyblockHud { @SubscribeEvent(priority = EventPriority.HIGHEST) public void onStatusBar(ClientChatReceivedEvent event) { - if ( - Utils - .removeColor(event.message.getUnformattedText()) - .toLowerCase() - .trim() - .startsWith("your profile was changed to:") - ) { + if (Utils.removeColor(event.message.getUnformattedText()).toLowerCase().trim().startsWith("your profile was changed to:")) { MinecraftForge.EVENT_BUS.post(new ProfileSwitchedEvent()); } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java index f03c6c0..56b5f56 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/Utils.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/Utils.java @@ -39,12 +39,7 @@ public class Utils { public static boolean isPlayerHoldingRedstone(EntityPlayerSP player) { if (!SkyblockHud.config.main.requireRedstone) return true; ArrayList<Item> redstoneItems = new ArrayList<>( - Arrays.asList( - Items.redstone, - Items.repeater, - Items.comparator, - Item.getByNameOrId("minecraft:redstone_torch") - ) + Arrays.asList(Items.redstone, Items.repeater, Items.comparator, Item.getByNameOrId("minecraft:redstone_torch")) ); if (player.getHeldItem() != null) return redstoneItems.contains(player.getHeldItem().getItem()); return false; @@ -138,15 +133,7 @@ public class Utils { return (shouldRender && ((type == null && Loader.isModLoaded("labymod")) || type == checkType)); } - public static void drawStringScaledMaxWidth( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringScaledMaxWidth(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) { int strLen = fr.getStringWidth(str); float factor = len / (float) strLen; factor = Math.min(1, factor); @@ -154,29 +141,13 @@ public class Utils { drawStringScaled(str, fr, x, y, shadow, colour, factor); } - public static void drawStringScaled( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int colour, - float factor - ) { + public static void drawStringScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int colour, float factor) { GlStateManager.scale(factor, factor, 1); fr.drawString(str, x / factor, y / factor, colour, shadow); GlStateManager.scale(1 / factor, 1 / factor, 1); } - public static void drawStringCenteredScaled( - String str, - FontRenderer fr, - float x, - float y, - boolean shadow, - int len, - int colour - ) { + public static void drawStringCenteredScaled(String str, FontRenderer fr, float x, float y, boolean shadow, int len, int colour) { int strLen = fr.getStringWidth(str); float factor = len / (float) strLen; float fontHeight = 8 * factor; @@ -197,12 +168,7 @@ public class Utils { ) { GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate( - GL11.GL_SRC_ALPHA, - GL11.GL_ONE_MINUS_SRC_ALPHA, - GL11.GL_ONE, - GL11.GL_ONE_MINUS_SRC_ALPHA - ); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter); @@ -230,16 +196,7 @@ public class Utils { drawTexturedRect(x, y, width, height, 0, 1, 0, 1, filter); } - public static void drawTexturedRect( - float x, - float y, - float width, - float height, - float uMin, - float uMax, - float vMin, - float vMax - ) { + public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax) { drawTexturedRect(x, y, width, height, uMin, uMax, vMin, vMax, GL11.GL_LINEAR); } @@ -271,9 +228,7 @@ public class Utils { } } - int newScale = guiScales.size() > 0 - ? Math.max(0, Math.min(4, guiScales.peek())) - : Minecraft.getMinecraft().gameSettings.guiScale; + int newScale = guiScales.size() > 0 ? Math.max(0, Math.min(4, guiScales.peek())) : Minecraft.getMinecraft().gameSettings.guiScale; if (newScale == 0) newScale = Minecraft.getMinecraft().gameSettings.guiScale; int oldScale = Minecraft.getMinecraft().gameSettings.guiScale; @@ -282,12 +237,7 @@ public class Utils { Minecraft.getMinecraft().gameSettings.guiScale = oldScale; if (guiScales.size() > 0) { - GlStateManager.viewport( - 0, - 0, - Minecraft.getMinecraft().displayWidth, - Minecraft.getMinecraft().displayHeight - ); + GlStateManager.viewport(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho( diff --git a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java index 8d6002b..db9ad38 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/api/LeaderboardGetter.java @@ -35,14 +35,9 @@ public class LeaderboardGetter { Scoreboard scoreboard = mc.theWorld.getScoreboard(); ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1); - if ( - sidebarObjective != null && - !MinecraftForge.EVENT_BUS.post(new SidebarPreGetEvent(scoreboard, sidebarObjective)) - ) { + if (sidebarObjective != null && !MinecraftForge.EVENT_BUS.post(new SidebarPreGetEvent(scoreboard, sidebarObjective))) { Collection<Score> scoreList = sidebarObjective.getScoreboard().getSortedScores(sidebarObjective); - Map<Integer, String> scores = scoreList - .stream() - .collect(Collectors.toMap(Score::getScorePoints, this::getLine)); + Map<Integer, String> scores = scoreList.stream().collect(Collectors.toMap(Score::getScorePoints, this::getLine)); if (!cachedScores.equals(scores)) { scores.forEach( diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 84e5483..c8f6d53 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -21,9 +21,7 @@ public class SBHConfig extends Config { height, () -> {}, () -> {}, - () -> - SkyblockHud.screenToOpen = - new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) + () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) ) ); } @@ -113,10 +111,7 @@ public class SBHConfig extends Config { public Position mainHudPos = new Position(0, 1, true, false); @Expose - @ConfigOption( - name = "Twelve Hour Clock", - desc = "Allows you to change the clock to be 12 hour instead of 24 hour." - ) + @ConfigOption(name = "Twelve Hour Clock", desc = "Allows you to change the clock to be 12 hour instead of 24 hour.") @ConfigEditorBoolean public boolean twelveHourClock = false; @@ -196,10 +191,7 @@ public class SBHConfig extends Config { public boolean hideDungeonPlayers = false; @Expose - @ConfigOption( - name = "Dungeon Player Opacity", - desc = "Allows you to change the opacity of the dungeon players." - ) + @ConfigOption(name = "Dungeon Player Opacity", desc = "Allows you to change the opacity of the dungeon players.") @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) @ConfigAccordionId(id = 1) public int dungeonPlayerOpacity = 0; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 3bac8ac..7dee8e6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -30,10 +30,7 @@ import org.lwjgl.opengl.GL11; public class SBHConfigEditor extends GuiElement { private static final ResourceLocation[] socialsIco = new ResourceLocation[] { DISCORD, TWITTER }; - private static final String[] socialsLink = new String[] { - "https://discord.gg/moulberry", - "https://twitter.com/thatgravytboat/" - }; + private static final String[] socialsLink = new String[] { "https://discord.gg/moulberry", "https://twitter.com/thatgravytboat/" }; private final long openedMillis; @@ -89,9 +86,7 @@ public class SBHConfigEditor extends GuiElement { return new LinkedHashMap<>(processedConfig); } - private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory( - ConfigProcessor.ProcessedCategory cat - ) { + private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory(ConfigProcessor.ProcessedCategory cat) { return new LinkedHashMap<>(cat.options); } @@ -217,10 +212,7 @@ public class SBHConfigEditor extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, fr, x + 75, y + 70 + catY, false, 100, -1); catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue()) - ); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue())); } } @@ -231,16 +223,12 @@ public class SBHConfigEditor extends GuiElement { if (categoryScroll.getTarget() / (float) (catY + categoryScroll.getValue()) + catBarSize < 1) { int target = optionsScroll.getTarget(); categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); categoryScroll.setTarget(target); } else { categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); } } @@ -322,10 +310,7 @@ public class SBHConfigEditor extends GuiElement { } GlStateManager.disableDepth(); if (optionY > 0) { - barSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue()) - ); + barSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue())); } } @@ -360,15 +345,8 @@ public class SBHConfigEditor extends GuiElement { } } int optionHeight = editor.getHeight(); - if ( - innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && - innerTop + 5 + optionYOverlay < innerBottom - 1 - ) { - editor.renderOverlay( - (innerLeft + innerRight - optionWidth) / 2 - 5, - innerTop + 5 + optionYOverlay, - optionWidth - ); + if (innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && innerTop + 5 + optionYOverlay < innerBottom - 1) { + editor.renderOverlay((innerLeft + innerRight - optionWidth) / 2 - 5, innerTop + 5 + optionYOverlay, optionWidth); } optionYOverlay += optionHeight + 5; } @@ -384,16 +362,12 @@ public class SBHConfigEditor extends GuiElement { if (optionsScroll.getTarget() / (float) (optionY + optionsScroll.getValue()) + barSize < 1) { int target = optionsScroll.getTarget(); optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); optionsScroll.setTarget(target); } else { optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); } } @@ -415,9 +389,7 @@ public class SBHConfigEditor extends GuiElement { if (mouseX >= socialLeft && mouseX <= socialLeft + 16 && mouseY >= y + 6 && mouseY <= y + 23) { tooltipToDisplay = - Lists.newArrayList( - EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex] - ); + Lists.newArrayList(EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex]); } } @@ -465,16 +437,14 @@ public class SBHConfigEditor extends GuiElement { float catBarSize = 1; int catY = -newTarget; - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) { if (getSelectedCategory() == null) { setSelectedCategory(entry.getKey()); } catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); } } @@ -519,10 +489,7 @@ public class SBHConfigEditor extends GuiElement { optionY += editor.getHeight() + 5; |
