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/thatgravyboat/skyblockhud/config | |
parent | c04ca523f9fb9f7adefa74587db61f76deeae9f0 (diff) | |
download | SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.tar.gz SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.tar.bz2 SkyblockHud-Death-Defied-98ee5a2ae8090c061b1e61e7955d793416991822.zip |
140?
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/config')
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java | 14 | ||||
-rw-r--r-- | src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java | 75 |
2 files changed, 20 insertions, 69 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java index 84e5483..c8f6d53 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfig.java @@ -21,9 +21,7 @@ public class SBHConfig extends Config { height, () -> {}, () -> {}, - () -> - SkyblockHud.screenToOpen = - new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) + () -> SkyblockHud.screenToOpen = new GuiScreenElementWrapper(new SBHConfigEditor(SkyblockHud.config, activeConfig)) ) ); } @@ -113,10 +111,7 @@ public class SBHConfig extends Config { public Position mainHudPos = new Position(0, 1, true, false); @Expose - @ConfigOption( - name = "Twelve Hour Clock", - desc = "Allows you to change the clock to be 12 hour instead of 24 hour." - ) + @ConfigOption(name = "Twelve Hour Clock", desc = "Allows you to change the clock to be 12 hour instead of 24 hour.") @ConfigEditorBoolean public boolean twelveHourClock = false; @@ -196,10 +191,7 @@ public class SBHConfig extends Config { public boolean hideDungeonPlayers = false; @Expose - @ConfigOption( - name = "Dungeon Player Opacity", - desc = "Allows you to change the opacity of the dungeon players." - ) + @ConfigOption(name = "Dungeon Player Opacity", desc = "Allows you to change the opacity of the dungeon players.") @ConfigEditorSlider(minValue = 0, maxValue = 100, minStep = 1) @ConfigAccordionId(id = 1) public int dungeonPlayerOpacity = 0; diff --git a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java index 3bac8ac..7dee8e6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/config/SBHConfigEditor.java @@ -30,10 +30,7 @@ import org.lwjgl.opengl.GL11; public class SBHConfigEditor extends GuiElement { private static final ResourceLocation[] socialsIco = new ResourceLocation[] { DISCORD, TWITTER }; - private static final String[] socialsLink = new String[] { - "https://discord.gg/moulberry", - "https://twitter.com/thatgravytboat/" - }; + private static final String[] socialsLink = new String[] { "https://discord.gg/moulberry", "https://twitter.com/thatgravytboat/" }; private final long openedMillis; @@ -89,9 +86,7 @@ public class SBHConfigEditor extends GuiElement { return new LinkedHashMap<>(processedConfig); } - private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory( - ConfigProcessor.ProcessedCategory cat - ) { + private LinkedHashMap<String, ConfigProcessor.ProcessedOption> getOptionsInCategory(ConfigProcessor.ProcessedCategory cat) { return new LinkedHashMap<>(cat.options); } @@ -217,10 +212,7 @@ public class SBHConfigEditor extends GuiElement { TextRenderUtils.drawStringCenteredScaledMaxWidth(catName, fr, x + 75, y + 70 + catY, false, 100, -1); catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue()) - ); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + categoryScroll.getValue())); } } @@ -231,16 +223,12 @@ public class SBHConfigEditor extends GuiElement { if (categoryScroll.getTarget() / (float) (catY + categoryScroll.getValue()) + catBarSize < 1) { int target = optionsScroll.getTarget(); categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); categoryScroll.setTarget(target); } else { categoryScroll.setValue( - (int) Math.ceil( - (catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue()) - ) + (int) Math.ceil((catY + 5 + categoryScroll.getValue()) - catBarSize * (catY + 5 + categoryScroll.getValue())) ); } } @@ -322,10 +310,7 @@ public class SBHConfigEditor extends GuiElement { } GlStateManager.disableDepth(); if (optionY > 0) { - barSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue()) - ); + barSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (optionY + 5 + optionsScroll.getValue())); } } @@ -360,15 +345,8 @@ public class SBHConfigEditor extends GuiElement { } } int optionHeight = editor.getHeight(); - if ( - innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && - innerTop + 5 + optionYOverlay < innerBottom - 1 - ) { - editor.renderOverlay( - (innerLeft + innerRight - optionWidth) / 2 - 5, - innerTop + 5 + optionYOverlay, - optionWidth - ); + if (innerTop + 5 + optionYOverlay + optionHeight > innerTop + 1 && innerTop + 5 + optionYOverlay < innerBottom - 1) { + editor.renderOverlay((innerLeft + innerRight - optionWidth) / 2 - 5, innerTop + 5 + optionYOverlay, optionWidth); } optionYOverlay += optionHeight + 5; } @@ -384,16 +362,12 @@ public class SBHConfigEditor extends GuiElement { if (optionsScroll.getTarget() / (float) (optionY + optionsScroll.getValue()) + barSize < 1) { int target = optionsScroll.getTarget(); optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); optionsScroll.setTarget(target); } else { optionsScroll.setValue( - (int) Math.ceil( - (optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue()) - ) + (int) Math.ceil((optionY + 5 + optionsScroll.getValue()) - barSize * (optionY + 5 + optionsScroll.getValue())) ); } } @@ -415,9 +389,7 @@ public class SBHConfigEditor extends GuiElement { if (mouseX >= socialLeft && mouseX <= socialLeft + 16 && mouseY >= y + 6 && mouseY <= y + 23) { tooltipToDisplay = - Lists.newArrayList( - EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex] - ); + Lists.newArrayList(EnumChatFormatting.YELLOW + "Go to: " + EnumChatFormatting.RESET + socialsLink[socialIndex]); } } @@ -465,16 +437,14 @@ public class SBHConfigEditor extends GuiElement { float catBarSize = 1; int catY = -newTarget; - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) { if (getSelectedCategory() == null) { setSelectedCategory(entry.getKey()); } catY += 15; if (catY > 0) { - catBarSize = - LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); + catBarSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (catY + 5 + newTarget)); } } @@ -519,10 +489,7 @@ public class SBHConfigEditor extends GuiElement { optionY += editor.getHeight() + 5; if (optionY > 0) { - barSize = - LerpUtils.clampZeroOne( - (float) (innerBottom - innerTop - 2) / (optionY + 5 + newTarget) - ); + barSize = LerpUtils.clampZeroOne((float) (innerBottom - innerTop - 2) / (optionY + 5 + newTarget)); } } } @@ -531,26 +498,18 @@ public class SBHConfigEditor extends GuiElement { if (newTarget > barMax) { newTarget = barMax; } - optionsScroll.setTimeToReachTarget( - Math.min(150, Math.max(10, 5 * Math.abs(newTarget - optionsScroll.getValue()))) - ); + optionsScroll.setTimeToReachTarget(Math.min(150, Math.max(10, 5 * Math.abs(newTarget - optionsScroll.getValue())))); optionsScroll.resetTimer(); optionsScroll.setTarget(newTarget); } } else if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) { if (getCurrentConfigEditing() != null) { int catY = -categoryScroll.getValue(); - for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing() - .entrySet()) { + for (Map.Entry<String, ConfigProcessor.ProcessedCategory> entry : getCurrentConfigEditing().entrySet()) { if (getSelectedCategory() == null) { setSelectedCategory(entry.getKey()); } - if ( - mouseX >= x + 5 && - mouseX <= x + 145 && - mouseY >= y + 70 + catY - 7 && - mouseY <= y + 70 + catY + 7 - ) { + if (mouseX >= x + 5 && mouseX <= x + 145 && mouseY >= y + 70 + catY - 7 && mouseY <= y + 70 + catY + 7) { setSelectedCategory(entry.getKey()); return true; } |