From f3410c50bdcc5c5ddbbdfa05ad539d178dfdbf84 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 4 Feb 2023 02:03:37 +0900 Subject: - Configuration Overhaul - Move to new system - more shaders!! Signed-off-by: syeyoung --- .../dungeonsguide/mod/commands/CommandDgDebug.java | 98 ++++--- .../mod/commands/CommandDungeonsGuide.java | 6 +- .../mod/config/guiconfig/ConfigPanelCreator.java | 40 --- .../mod/config/guiconfig/GuiConfigV2.java | 59 ---- .../mod/config/guiconfig/MCategory.java | 103 ------- .../mod/config/guiconfig/MCategoryElement.java | 82 ------ .../mod/config/guiconfig/MFeature.java | 153 ---------- .../mod/config/guiconfig/MFeatureEdit.java | 114 -------- .../mod/config/guiconfig/MNotFound.java | 38 --- .../mod/config/guiconfig/MPanelCategory.java | 83 ------ .../mod/config/guiconfig/MParameterEdit.java | 220 --------------- .../mod/config/guiconfig/NestedCategory.java | 54 ---- .../mod/config/guiconfig/RootConfigPanel.java | 313 --------------------- .../mod/config/guiconfig/configv3/FeatureItem.java | 2 + .../config/guiconfig/configv3/MainPageWidget.java | 5 + .../config/guiconfig/configv3/ParameterItem.java | 72 +++++ .../dungeonsguide/mod/config/types/AColor.java | 2 + .../mod/config/types/FeatureTypeHandler.java | 32 +++ .../dungeonsguide/mod/config/types/TCAColor.java | 109 ++++++- .../dungeonsguide/mod/config/types/TCBoolean.java | 36 ++- .../dungeonsguide/mod/config/types/TCColor.java | 41 --- .../dungeonsguide/mod/config/types/TCEnum.java | 104 +++++++ .../dungeonsguide/mod/config/types/TCFloat.java | 59 +++- .../mod/config/types/TCGUIPosition.java | 7 +- .../dungeonsguide/mod/config/types/TCInteger.java | 55 +++- .../dungeonsguide/mod/config/types/TCKeybind.java | 64 ++++- .../mod/config/types/TCRectangle.java | 7 +- .../dungeonsguide/mod/config/types/TCString.java | 31 +- .../mod/config/types/TCStringList.java | 7 +- .../mod/config/types/TCTextStyle.java | 15 +- .../mod/config/types/TCTextStyleList.java | 11 +- .../mod/config/types/TypeConverter.java | 29 -- .../mod/config/types/TypeConverterRegistry.java | 32 +-- .../mod/config/types/coloredit/AlphaBar.java | 138 +++++++++ .../mod/config/types/coloredit/ChromaBar.java | 149 ++++++++++ .../mod/config/types/coloredit/ColorEditPopup.java | 70 +++++ .../mod/config/types/coloredit/ColorWheel.java | 147 ++++++++++ .../mod/config/types/coloredit/ValueBar.java | 150 ++++++++++ .../mod/features/AbstractFeature.java | 36 +-- .../mod/features/AbstractHUDFeature.java | 55 +++- .../mod/features/FeatureParameter.java | 33 ++- .../mod/features/FeatureRegistry.java | 13 +- .../impl/advanced/FeatureDebuggableMap.java | 6 - .../features/impl/advanced/FeatureTestPeople.java | 3 +- .../mod/features/impl/boss/FeatureBossHealth.java | 7 +- .../features/impl/boss/FeatureBoxRealLivid.java | 3 +- .../mod/features/impl/boss/FeatureHideAnimals.java | 11 +- .../features/impl/boss/FeatureWarningOnPortal.java | 27 +- .../impl/cosmetics/FeatureNicknameColor.java | 11 +- .../impl/cosmetics/FeatureNicknamePrefix.java | 12 +- .../discord/inviteViewer/PartyInviteViewer.java | 5 +- .../impl/discord/onlinealarm/PlayingDGAlarm.java | 2 - .../mod/features/impl/dungeon/FeatureBoxBats.java | 6 +- .../impl/dungeon/FeatureBoxSkelemaster.java | 6 +- .../features/impl/dungeon/FeatureBoxStarMobs.java | 6 +- .../features/impl/dungeon/FeatureDungeonMap.java | 32 +-- .../features/impl/dungeon/FeatureDungeonScore.java | 3 +- .../dungeon/FeaturePressAnyKeyToCloseChest.java | 3 +- .../impl/dungeon/FeatureWarnLowHealth.java | 3 +- .../impl/etc/FeatureDecreaseExplosionSound.java | 3 +- .../features/impl/etc/FeatureDisableMessage.java | 3 +- .../features/impl/etc/FeatureEpicCountdown.java | 5 +- .../features/impl/etc/FeatureRepartyCommand.java | 3 +- .../mod/features/impl/etc/FeatureTooltipPrice.java | 3 +- .../impl/etc/ability/FeatureAbilityCooldown.java | 6 +- .../mod/features/impl/party/APIKey.java | 3 +- .../impl/party/customgui/PanelPartyFinder.java | 16 +- .../FeatureViewPlayerStatsOnJoin.java | 30 +- .../impl/party/playerpreview/api/SkinFetcher.java | 1 - .../playerpreview/widget/WidgetProfileViewer.java | 2 - .../widget/WidgetProfileViewerData.java | 3 - .../mod/features/impl/secret/FeatureBloodRush.java | 3 +- .../impl/secret/FeatureCreateRefreshLine.java | 34 +-- .../impl/secret/FeatureFreezePathfind.java | 3 +- .../impl/secret/FeaturePathfindStrategy.java | 62 +--- .../features/impl/secret/FeaturePathfindToAll.java | 9 +- .../impl/secret/FeatureSoulRoomWarning.java | 192 +++++-------- .../impl/secret/FeatureTogglePathfind.java | 3 +- .../impl/secret/PathfindLineProperties.java | 45 +-- .../mechanicbrowser/FeatureMechanicBrowse.java | 11 +- .../features/impl/solvers/FeatureSolverBlaze.java | 9 +- .../impl/solvers/FeatureSolverBombdefuse.java | 3 +- .../features/impl/solvers/FeatureSolverBox.java | 15 +- .../impl/solvers/FeatureSolverIcefill.java | 6 +- .../features/impl/solvers/FeatureSolverKahoot.java | 3 +- .../features/impl/solvers/FeatureSolverRiddle.java | 3 +- .../impl/solvers/FeatureSolverSilverfish.java | 6 +- .../impl/solvers/FeatureSolverTeleport.java | 5 +- .../impl/solvers/FeatureSolverTictactoe.java | 5 +- .../mod/features/text/TextHUDFeature.java | 77 +---- .../kr/syeyoung/dungeonsguide/mod/gui/MPanel.java | 3 +- .../dungeonsguide/mod/guiv2/elements/AbsXY.java | 2 +- .../dungeonsguide/mod/guiv2/elements/Border.java | 2 +- .../mod/guiv2/elements/CompatLayer.java | 169 +++++++++++ .../mod/guiv2/elements/NegativeStencil.java | 112 ++++++++ .../mod/guiv2/elements/TextField.java | 1 + .../guiv2/elements/popups/AbsLocationPopup.java | 16 +- .../mod/guiv2/renderer/RenderingContext.java | 4 + .../mod/guiv2/xml/DomElementRegistry.java | 1 + 99 files changed, 1907 insertions(+), 1995 deletions(-) delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/ParameterItem.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/FeatureTypeHandler.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCColor.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TCEnum.java delete mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/TypeConverter.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/AlphaBar.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ChromaBar.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorEditPopup.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ColorWheel.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/types/coloredit/ValueBar.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/CompatLayer.java create mode 100644 mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/NegativeStencil.java (limited to 'mod/src/main/java') diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java index 7bd4d489..239ee14e 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDgDebug.java @@ -26,7 +26,6 @@ import kr.syeyoung.dungeonsguide.launcher.Main; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.SkyblockStatus; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.NestedCategory; import kr.syeyoung.dungeonsguide.mod.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.mod.dungeon.events.DungeonEventHolder; import kr.syeyoung.dungeonsguide.mod.dungeon.roomfinder.DungeonRoom; @@ -57,7 +56,6 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.Tuple; import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.opengl.*; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; @@ -558,54 +556,54 @@ public class CommandDgDebug extends CommandBase { } private void dumpSettingsCommand() { - NestedCategory nestedCategory = new NestedCategory("ROOT"); - for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { - String category = abstractFeature.getCategory(); - NestedCategory currentRoot = nestedCategory; - for (String s : category.split("\\.")) { - NestedCategory finalCurrentRoot = currentRoot; - if (currentRoot.children().containsKey(s)) { - currentRoot = currentRoot.children().get(s); - } else { - currentRoot.child(currentRoot = new NestedCategory(finalCurrentRoot.categoryFull() + "." + s)); - } - } - } - - StringBuilder stringBuilder = new StringBuilder(); - StringBuilder stringBuilder2 = new StringBuilder(); - - Stack> stak = new Stack<>(); - stak.push(new Tuple<>(nestedCategory, 0)); - Set discovered = new HashSet<>(); - while (!stak.isEmpty()) { - Tuple n = stak.pop(); - if (discovered.contains(n.getFirst())) { - continue; - } - discovered.add(n.getFirst()); - for (Map.Entry stringNestedCategoryEntry : n.getFirst().children().entrySet()) { - stak.push(new Tuple<>(stringNestedCategoryEntry.getValue(), n.getSecond() + 1)); - } - - if (n.getFirst().categoryFull().equals("ROOT")) { - continue; - } - - String prefix = ""; - for (int i = 0; i < n.getSecond() - 1; i++) { - prefix += " "; - } - - List abstractFeatureList = FeatureRegistry.getFeaturesByCategory().getOrDefault(n.getFirst().categoryFull().substring(5), Collections.emptyList()); - stringBuilder.append(prefix).append("- C ").append(n.getFirst().categoryFull()).append("\n"); - stringBuilder2.append(n.getFirst().categoryFull()).append("\n"); - for (AbstractFeature abstractFeature : abstractFeatureList) { - stringBuilder.append(prefix).append(" - F ").append(abstractFeature.getName()).append(" / ").append(abstractFeature.getDescription().replace("\n", "$NEW_LINE$")).append("\n"); - } - } - System.out.println(stringBuilder.toString()); - System.out.println(stringBuilder2.toString()); +// NestedCategory nestedCategory = new NestedCategory("ROOT"); +// for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) { +// String category = abstractFeature.getCategory(); +// NestedCategory currentRoot = nestedCategory; +// for (String s : category.split("\\.")) { +// NestedCategory finalCurrentRoot = currentRoot; +// if (currentRoot.children().containsKey(s)) { +// currentRoot = currentRoot.children().get(s); +// } else { +// currentRoot.child(currentRoot = new NestedCategory(finalCurrentRoot.categoryFull() + "." + s)); +// } +// } +// } +// +// StringBuilder stringBuilder = new StringBuilder(); +// StringBuilder stringBuilder2 = new StringBuilder(); +// +// Stack> stak = new Stack<>(); +// stak.push(new Tuple<>(nestedCategory, 0)); +// Set discovered = new HashSet<>(); +// while (!stak.isEmpty()) { +// Tuple n = stak.pop(); +// if (discovered.contains(n.getFirst())) { +// continue; +// } +// discovered.add(n.getFirst()); +// for (Map.Entry stringNestedCategoryEntry : n.getFirst().children().entrySet()) { +// stak.push(new Tuple<>(stringNestedCategoryEntry.getValue(), n.getSecond() + 1)); +// } +// +// if (n.getFirst().categoryFull().equals("ROOT")) { +// continue; +// } +// +// String prefix = ""; +// for (int i = 0; i < n.getSecond() - 1; i++) { +// prefix += " "; +// } +// +// List abstractFeatureList = FeatureRegistry.getFeaturesByCategory().getOrDefault(n.getFirst().categoryFull().substring(5), Collections.emptyList()); +// stringBuilder.append(prefix).append("- C ").append(n.getFirst().categoryFull()).append("\n"); +// stringBuilder2.append(n.getFirst().categoryFull()).append("\n"); +// for (AbstractFeature abstractFeature : abstractFeatureList) { +// stringBuilder.append(prefix).append(" - F ").append(abstractFeature.getName()).append(" / ").append(abstractFeature.getDescription().replace("\n", "$NEW_LINE$")).append("\n"); +// } +// } +// System.out.println(stringBuilder.toString()); +// System.out.println(stringBuilder2.toString()); } private void readMapCommand(String[] args) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java index c40a0a80..fed67faf 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java @@ -22,7 +22,6 @@ import com.mojang.authlib.GameProfile; import kr.syeyoung.dungeonsguide.launcher.Main; import kr.syeyoung.dungeonsguide.mod.DungeonsGuide; import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.GuiConfigV2; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.configv3.MainConfigWidget; import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager; @@ -92,7 +91,7 @@ public class CommandDungeonsGuide extends CommandBase { public void processCommand(ICommandSender sender, String[] args) { if (args.length == 0) { - target = new GuiConfigV2(); + target = new GuiScreenAdapter(new GlobalHUDScale(new MainConfigWidget())); return; } @@ -104,9 +103,6 @@ public class CommandDungeonsGuide extends CommandBase { case "gui": target = new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig(null))); break; - case "v3": - target = new GuiScreenAdapter(new GlobalHUDScale(new MainConfigWidget())); - break; case "pv": pvCommand(args[1], sender); //args[1] is the player name break; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java deleted file mode 100644 index da3974a3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/ConfigPanelCreator.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; -import java.util.Map; - -public class ConfigPanelCreator implements Function { - public static final ConfigPanelCreator INSTANCE = new ConfigPanelCreator(); - - public static final Map> map = new HashMap>(); - - @Nullable - @Override - public MPanel apply(@Nullable String input) { - if (!map.containsKey(input)) return null; - return map.get(input).get(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java deleted file mode 100644 index 0f6be522..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/GuiConfigV2.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.gui.MGui; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.util.MathHelper; - -import java.awt.*; - -public class GuiConfigV2 extends MGui { - - @Getter - private RootConfigPanel rootConfigPanel; - - public GuiConfigV2() { - rootConfigPanel = new RootConfigPanel(this); - getMainPanel().add(rootConfigPanel); - } - - - @Override - public void initGui() { - super.initGui(); - int dw = Minecraft.getMinecraft().displayWidth; - int dh = Minecraft.getMinecraft().displayHeight; - int width = MathHelper.clamp_int(dw - 200, 1250, 1500), height = MathHelper.clamp_int(dh - 200, 600, 800); - double scale = 2.0; - if (dw <= width || dh <= height) { - width = width/2; height = height/2; - scale = 1.0; - } - rootConfigPanel.setBounds(new Rectangle((dw-width)/2, (dh-height)/2, width,height)); - rootConfigPanel.setScale(scale); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java deleted file mode 100644 index c4561c09..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategory.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; - -public class MCategory extends MPanel { - - private NestedCategory nestedCategory; - private RootConfigPanel rootConfigPanel; - @Getter - @Setter - private Color hover = new Color(94, 94, 94, 255); - public MCategory(NestedCategory nestedCategory, RootConfigPanel rootConfigPanel) { - this.nestedCategory = nestedCategory; - this.rootConfigPanel = rootConfigPanel; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - int border = RenderUtils.blendAlpha(0x141414, 0.12f); - if (!rootConfigPanel.getSearchWord().isEmpty() && (nestedCategory.categoryName().toLowerCase().contains(rootConfigPanel.getSearchWord()))) { - border = 0xFF02EE67; - } - - Gui.drawRect(0,0,getBounds().width, getBounds().height,border); - if (getBounds().height >= 28) - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(1,1,getBounds().width-1, 18, RenderUtils.blendAlpha(0x141414, 0.12f)); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(5,5,0); - GlStateManager.scale(1.0,1.0,0); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - - fr.drawString((lastAbsClip.contains(absMousex, absMousey) ? "§n" : "") + nestedCategory.categoryName(), 0,0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - - fr.drawSplitString(FeatureRegistry.getCategoryDescription().getOrDefault(nestedCategory.categoryFull(), ""), 5, 23, getBounds().width -10, 0xFFBFBFBF); - } - - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - int descriptionHeight = - FeatureRegistry.getCategoryDescription().containsKey(nestedCategory.categoryFull()) ? - fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().get(nestedCategory.categoryFull()), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT - : -9; - - return new Dimension(100, descriptionHeight + 28); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (lastAbsClip.contains(absMouseX, absMouseY)) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); - rootConfigPanel.setCurrentPageAndPushHistory(nestedCategory.categoryFull()); - } - } - - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY)) - setCursor(EnumCursor.POINTING_HAND); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java deleted file mode 100644 index af23d306..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MCategoryElement.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.mod.utils.cursor.EnumCursor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.util.ResourceLocation; - -import java.awt.*; - -public class MCategoryElement extends MPanel { - private String category; - private Runnable onClick; - private int leftPad = 0; - private int offsetX; - private RootConfigPanel rootConfigPanel; - public MCategoryElement(String category, Runnable onClick, int leftPad, int offsetX, RootConfigPanel root) { - this.category = category; - this.onClick = onClick; - this.leftPad = leftPad; - this.offsetX = offsetX; - this.rootConfigPanel = root; - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (rootConfigPanel.getCurrentPage().equals(category)) { - clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height); - Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.13f)); - } else if (lastAbsClip.contains(absMousex, absMousey) && getTooltipsOpen() == 0) { - clip(0,scissor.y, Minecraft.getMinecraft().displayWidth, scissor.height); - Gui.drawRect(leftPad - offsetX, 0, getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.09f)); - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - String name = category.substring(category.lastIndexOf(".")+1); - fr.drawString(name, leftPad,2,-1); - - } - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - return new Dimension(fr.getStringWidth(category.substring(category.lastIndexOf(".")+1)) + leftPad+10, fr.FONT_HEIGHT+4); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (!lastAbsClip.contains(absMouseX, absMouseY) || getTooltipsOpen() > 0) { return; } - if (onClick != null) onClick.run(); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); - - } - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY)) - setCursor(EnumCursor.POINTING_HAND); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java deleted file mode 100644 index 9cb6c946..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeature.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.RawRenderingGuiFeature; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class MFeature extends MPanel { - - @Getter - private final AbstractFeature feature; - - private final List addons = new ArrayList(); - - @Getter @Setter - private Color hover; - - private final RootConfigPanel panel; - - public MFeature(final AbstractFeature abstractFeature, final RootConfigPanel panel) { - this.panel = panel; - this.feature = abstractFeature; - - if (abstractFeature.isDisyllable()) { - final MToggleButton mStringSelectionButton = new MToggleButton(); - mStringSelectionButton.setOnToggle(new Runnable() { - @Override - public void run() { - boolean selected = mStringSelectionButton.isEnabled(); - feature.setEnabled(selected); - } - }); - mStringSelectionButton.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f)); - addons.add(mStringSelectionButton); - mStringSelectionButton.setEnabled(feature.isEnabled()); - mStringSelectionButton.setSize(new Dimension(40, 15)); - add(mStringSelectionButton); - } - if (abstractFeature.getParameters().size() != 0) { - MButton button = new MButton(); - button.setText("Settings"); - button.setOnActionPerformed(new Runnable() { - @Override - public void run() { - panel.setCurrentPageAndPushHistory(abstractFeature.getEditRoute(panel)); - } - }); - button.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f)); - button.setClicked(RenderUtils.blendAlpha(0x141414, 0.17f)); - button.setHover(RenderUtils.blendAlpha(0x141414, 0.17f)); - addons.add(button); - button.setSize(new Dimension(50, 15)); - add(button); - } - if (abstractFeature instanceof RawRenderingGuiFeature) { - MButton button = new MButton(); - button.setText("Relocate"); - button.setOnActionPerformed(new Runnable() { - @Override - public void run() { -// Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(Minecraft.getMinecraft().currentScreen, abstractFeature)); - button.setBeingClicked(false); - } - }); - button.setBackground(RenderUtils.blendAlpha(0x141414, 0.07f)); - button.setClicked(RenderUtils.blendAlpha(0x141414, 0.17f)); - button.setHover(RenderUtils.blendAlpha(0x141414, 0.17f)); - addons.add(button); - button.setSize(new Dimension(75, 15)); - add(button); - } - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - - int border = RenderUtils.blendAlpha(0x141414, 0.12f); - if (!panel.getSearchWord().isEmpty() && (feature.getName().toLowerCase().contains(panel.getSearchWord()) || feature.getDescription().toLowerCase().contains(panel.getSearchWord()))) { - border = 0xFF02EE67; - } - - Gui.drawRect(0,0,getBounds().width, getBounds().height,border); - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(1,1,getBounds().width-1, 18, RenderUtils.blendAlpha(0x141414, 0.12f)); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(5,5,0); - GlStateManager.scale(1.0,1.0,0); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(feature.getName(), 0,0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - - fr.drawSplitString(feature.getDescription(), 5, 23, getBounds().width -10, 0xFFBFBFBF); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setSize(new Dimension(parentWidth, getBounds().height)); - } - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int descriptionHeight = fr.listFormattedStringToWidth(feature.getDescription(), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT; - - return new Dimension(100, descriptionHeight + 28); - } - - @Override - public void onBoundsUpdate() { - int x = getBounds().width - 5; - for (MPanel panel : addons) { - panel.setBounds(new Rectangle(x - panel.getPreferredSize().width, 3, panel.getPreferredSize().width, 12)); - x -= panel.getPreferredSize().width + 5; - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java deleted file mode 100644 index c7a1e6ab..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MFeatureEdit.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - - -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MModalConfirmation; - -import java.awt.*; -import java.util.HashMap; -import java.util.Map; - -public class MFeatureEdit extends MPanel { - private MList list; - private MButton goBack, resetToDefault; - private RootConfigPanel rootConfigPanel; - private AbstractFeature abstractFeature; - - private Map parameterEdits = new HashMap<>(); - - public MFeatureEdit(AbstractFeature abstractFeature, RootConfigPanel rootConfigPanel) { - this.abstractFeature = abstractFeature; - this.rootConfigPanel = rootConfigPanel; - list = new MList(); - list.setGap(5); - list.setDrawLine(false); - add(list); - - goBack = new MButton(); - goBack.setText("< Go Back"); - goBack.setOnActionPerformed(rootConfigPanel::goBack); - add(goBack); - resetToDefault = new MButton(); - resetToDefault.setText("Reset To Default"); - resetToDefault.setForeground(Color.red); - resetToDefault.setOnActionPerformed(() -> { - openResetConfirmation(); - }); - add(resetToDefault); - } - - public void openResetConfirmation() { - MModalConfirmation mModal = new MModalConfirmation("Are you sure?", - "Resetting to default will reset your configuration for the selected feature to default", - () -> { - for (FeatureParameter parameter : abstractFeature.getParameters()) { - parameter.setToDefault(); - } - abstractFeature.onParameterReset(); - rootConfigPanel.invalidatePage(abstractFeature.getEditRoute(rootConfigPanel)); - }, () -> {}); - mModal.setScale(getScale()); - mModal.getYes().setBorder(0xFFFF0000); - mModal.getYes().setText("Yes, Reset it"); - mModal.getNo().setText("Cancel"); - mModal.open(MFeatureEdit.this); - } - - public void addParameterEdit(String name, MPanel paramEdit) { - parameterEdits.put(name, paramEdit); - list.add(paramEdit); - } - public MPanel removeParameterEdit(String name) { - MPanel panel = parameterEdits.remove(name); - list.remove(panel); - return panel; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - super.resize(parentWidth, parentHeight); - setBounds(new Rectangle(0,0,parentWidth,parentHeight)); - Dimension prefSize = getPreferredSize(); - int hei = prefSize.height; - setBounds(new Rectangle(0,0,parentWidth,hei)); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - goBack.setBounds(new Rectangle(5,5,75,15)); - resetToDefault.setBounds(new Rectangle(bounds.width - 105, 5, 100, 15)); - - list.setBounds(new Rectangle(5,25,bounds.width - 10, bounds.height - 10)); - list.realignChildren(); - - } - - @Override - public Dimension getPreferredSize() { - Dimension listPref = list.getPreferredSize(); - return new Dimension(listPref.width + 10, listPref.height + 30); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java deleted file mode 100644 index b63c4e90..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MNotFound.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; - -import java.awt.*; - -public class MNotFound extends MPanel { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,0,parentWidth,parentHeight)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("404 Not Found", (getBounds().width - fr.getStringWidth("404 Not Found")) / 2, (getBounds().height - fr.FONT_HEIGHT) / 2, -1); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java deleted file mode 100644 index 435940d3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MPanelCategory.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.MList; - -import java.awt.*; - -public class MPanelCategory extends MPanel { - - private NestedCategory key; - private RootConfigPanel rootConfigPanel; - - private MList list; - - public MPanelCategory(NestedCategory nestedCategory, RootConfigPanel rootConfigPanel) { - this.key = nestedCategory; - this.rootConfigPanel = rootConfigPanel; - - list = new MList(); - list.setDrawLine(false); - list.setGap(5); - add(list); - - for (NestedCategory value : nestedCategory.children().values()) { - list.add(new MCategory(value, rootConfigPanel)); - } - if (nestedCategory.parent() != null) { - String actualCategory = nestedCategory.categoryFull().substring(5); - if (FeatureRegistry.getFeaturesByCategory().containsKey(actualCategory)) - for (AbstractFeature abstractFeature : FeatureRegistry.getFeaturesByCategory().get(actualCategory)) { - MFeature mFeature = new MFeature(abstractFeature, rootConfigPanel); - list.add(mFeature); - mFeature.setHover(new Color(94, 94, 94, 255)); - } - } - list.realignChildren(); - - } - - @Override - public void resize(int parentWidth, int parentHeight) { - super.resize(parentWidth, parentHeight); - setBounds(new Rectangle(0,0,parentWidth,parentHeight)); - Dimension prefSize = getPreferredSize(); - int hei = prefSize.height; - setBounds(new Rectangle(0,0,parentWidth,hei)); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - list.setBounds(new Rectangle(5,5,bounds.width- 10, bounds.height - 10)); - list.realignChildren(); - } - - @Override - public Dimension getPreferredSize() { - Dimension prefSize = list.getPreferredSize(); - int wid = prefSize.width + 10; - int hei = prefSize.height + 10; - return new Dimension(wid, hei); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java deleted file mode 100644 index 9cf5a6ed..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/MParameterEdit.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - - -import kr.syeyoung.dungeonsguide.mod.config.types.AColor; -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.*; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; - -import java.awt.*; -import java.util.function.Predicate; - -public class MParameterEdit extends MPanel { - private AbstractFeature abstractFeature; - private FeatureParameter featureParameter; - private RootConfigPanel rootConfigPanel; - private MPanel valueEditHolder; - private MPanel valueEdit; - - private Predicate isDisabled ; - - public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel) { - this(abstractFeature, parameter, rootConfigPanel, (a) -> false); - } - - public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel, Predicate isDisabled ) { - this.abstractFeature = abstractFeature; - this.featureParameter = parameter; - this.rootConfigPanel = rootConfigPanel; - this.isDisabled = isDisabled; - - if (parameter.getValue_type().equals("string")) { - valueEdit = new MTextField() { - @Override - public void edit(String str) { - parameter.setValue(str); - } - }; - ((MTextField)valueEdit).setText((String) parameter.getValue()); - } else if (parameter.getValue_type().equals("integer")) { - valueEdit = new MIntegerSelectionButton((Integer) parameter.getValue()); - ((MIntegerSelectionButton)valueEdit).setOnUpdate(() -> { - parameter.setValue(((MIntegerSelectionButton) valueEdit).getData()); - }); - } else if (parameter.getValue_type().equals("float")) { - valueEdit = new MFloatSelectionButton((Float) parameter.getValue()); - ((MFloatSelectionButton)valueEdit).setOnUpdate(() -> { - parameter.setValue(((MFloatSelectionButton) valueEdit).getData()); - }); - } else if (parameter.getValue_type().equals("acolor")) { - valueEdit = new MEditableAColor(); - ((MEditableAColor)valueEdit).setColor((AColor) parameter.getValue()); - ((MEditableAColor)valueEdit).setEnableEdit(true); - ((MEditableAColor)valueEdit).setOnUpdate(() -> { - parameter.setValue(((MEditableAColor) valueEdit).getColor()); - }); - } else if (parameter.getValue_type().equals("color")) { - valueEdit = new MEditableAColor(); - ((MEditableAColor)valueEdit).setColor(new AColor(((Color) parameter.getValue()).getRGB(), true)); - ((MEditableAColor)valueEdit).setEnableEdit(true); - ((MEditableAColor)valueEdit).setOnUpdate(() -> { - parameter.setValue(((MEditableAColor) valueEdit).getColor()); - }); - } else if (parameter.getValue_type().equals("boolean")) { - valueEdit = new MToggleButton(); - ((MToggleButton)valueEdit).setEnabled((Boolean) parameter.getValue()); - ((MToggleButton)valueEdit).setOnToggle(() -> { - parameter.setValue(((MToggleButton) valueEdit).isEnabled()); - }); - } else if (parameter.getValue_type().equals("keybind")) { - valueEdit = new MKeyEditButton(); - ((MKeyEditButton)valueEdit).setKey((Integer) parameter.getValue()); - ((MKeyEditButton)valueEdit).setOnKeyEdit(() -> { - parameter.setValue(((MKeyEditButton) valueEdit).getKey()); - }); - ((MKeyEditButton)valueEdit).setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67)); - }else { - valueEdit = new MLabel(); - ((MLabel)valueEdit).setText("????"); - } - - - valueEditHolder = new MPanel() { - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - Dimension dimension = valueEdit.getPreferredSize(); - if (dimension.width <= 0) dimension.width = bounds.width/2; - if (dimension.height <= 0) dimension.height = bounds.height/2; - valueEdit.setBounds(new Rectangle((bounds.width - dimension.width)/2,(bounds.height - dimension.height)/2,dimension.width, dimension.height)); - } - }; - add(valueEditHolder); - valueEditHolder.add(valueEdit); - } - public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel, MPanel valueEdit, Predicate isDisabled) { - this.abstractFeature = abstractFeature; - this.featureParameter = parameter; - this.rootConfigPanel = rootConfigPanel; - this.isDisabled = isDisabled; - - - valueEditHolder = new MPanel() { - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - Dimension dimension = valueEdit.getPreferredSize(); - if (dimension.width <= 0) dimension.width = bounds.width/2; - if (dimension.height <= 0) dimension.height = bounds.height/2; - valueEdit.setBounds(new Rectangle((bounds.width - dimension.width)/2,(bounds.height - dimension.height)/2,dimension.width, dimension.height)); - } - }; - add(valueEditHolder); - valueEditHolder.add(valueEdit); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f)); - Gui.drawRect(2*bounds.width / 3,1,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(4, 15,2*bounds.width / 3-5, 16, RenderUtils.blendAlpha(0x141414, 0.3f)); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString(featureParameter.getName(), 5,5, 0xFFFFFFFF); - fr.drawSplitString(featureParameter.getDescription(), 5,18, 2*bounds.width /3-10, 0xFFAAAAAA); - - } - - @Override - public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) { - super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); - if (isDisabled.test(featureParameter)) { - Gui.drawRect(0,0, getBounds().width, getBounds().height, 0x55000000); - } - } - - @Override - public Dimension getPreferredSize() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int descriptionHeight = fr.listFormattedStringToWidth(featureParameter.getDescription(), Math.max(50, 2*bounds.width/3-10)).size() * fr.FONT_HEIGHT; - return new Dimension(100, Math.max(30, descriptionHeight + 23)); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - valueEditHolder.setBounds(new Rectangle(2*bounds.width / 3, 0, bounds.width / 3, bounds.height)); - } - - @Override - public void keyPressed0(char typedChar, int keyCode) { - if (isDisabled.test(featureParameter)) return; - super.keyPressed0(typedChar, keyCode); - } - - @Override - public void keyHeld0(char typedChar, int keyCode) { - if (isDisabled.test(featureParameter)) return; - super.keyHeld0(typedChar, keyCode); - } - - @Override - public void keyReleased0(char typedChar, int keyCode) { - if (isDisabled.test(featureParameter)) return; - super.keyReleased0(typedChar, keyCode); - } - - @Override - public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { - if (isDisabled.test(featureParameter)) return false; - return super.mouseClicked0(absMouseX, absMouseY, relMouseX0, relMouseY0, mouseButton); - } - - @Override - public void mouseReleased0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int state) { - if (isDisabled.test(featureParameter)) return ; - super.mouseReleased0(absMouseX, absMouseY, relMouseX0, relMouseY0, state); - } - - @Override - public void mouseClickMove0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int clickedMouseButton, long timeSinceLastClick) { - if (isDisabled.test(featureParameter)) return ; - super.mouseClickMove0(absMouseX, absMouseY, relMouseX0, relMouseY0, clickedMouseButton, timeSinceLastClick); - } - - @Override - public void mouseScrolled0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if (isDisabled.test(featureParameter)) return ; - super.mouseScrolled0(absMouseX, absMouseY, relMouseX0, relMouseY0, scrollAmount); - } - - @Override - public void mouseMoved0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (isDisabled.test(featureParameter)) return ; - super.mouseMoved0(absMouseX, absMouseY, relMouseX0, relMouseY0); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java deleted file mode 100644 index 28a3d4d1..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/NestedCategory.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; -import lombok.experimental.Accessors; - -import java.util.LinkedHashMap; -import java.util.Map; - -@Data -@Accessors(chain = true, fluent = true) -public -class NestedCategory { - private final String categoryFull; - @EqualsAndHashCode.Exclude - private String categoryName; - @EqualsAndHashCode.Exclude - @ToString.Exclude - private NestedCategory parent; - - public NestedCategory(String categoryFull) { - this.categoryFull = categoryFull; - this.categoryName = categoryFull.substring(categoryFull.lastIndexOf(".") + 1); - } - - @EqualsAndHashCode.Exclude - @ToString.Exclude - private Map children = new LinkedHashMap<>(); - - public NestedCategory child(NestedCategory child) { - this.children.put(child.categoryName, child); - child.parent = this; - return this; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java deleted file mode 100644 index 6db1a9ae..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/RootConfigPanel.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package kr.syeyoung.dungeonsguide.mod.config.guiconfig; - -import com.google.common.base.Function; -import kr.syeyoung.dungeonsguide.launcher.auth.AuthManager; -import kr.syeyoung.dungeonsguide.mod.config.guiconfig.location2.HUDLocationConfig; -import kr.syeyoung.dungeonsguide.mod.features.AbstractFeature; -import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.mod.gui.MPanel; -import kr.syeyoung.dungeonsguide.mod.gui.elements.*; -import kr.syeyoung.dungeonsguide.mod.guiv2.GuiScreenAdapter; -import kr.syeyoung.dungeonsguide.mod.guiv2.elements.GlobalHUDScale; -import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; - -import java.awt.*; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.*; - -public class RootConfigPanel extends MPanelScaledGUI { - private MScrollablePanel navigationScroll; - - private MList navigation = new MList(); - - private MScrollablePanel contentScroll; - - - private final Map pages = new HashMap(); - @Getter - @Setter - private Function pageGenerator = ConfigPanelCreator.INSTANCE; - @Getter - private String currentPage = ""; - - private GuiConfigV2 gui; - - private long lastPageSet = System.currentTimeMillis(); - - private MTextField search; - private MButton guiRelocate; - - private MButton github, discord; - - private final Stack history = new Stack(); - - public String getSearchWord() { - return search.getText().trim().toLowerCase(); - } - - public RootConfigPanel(GuiConfigV2 guiConfigV2) { - this.gui = guiConfigV2; - - search = new MTextField() { - @Override - public void edit(String str) { - setupNavigation(); - - setCurrentPageAndPushHistory(""); - if (!categoryMap.containsKey(lastOpenCategory)) { - for (Map.Entry nestedCategoryMPanelEntry : categoryMap.entrySet()) { - if (nestedCategoryMPanelEntry.getValue() instanceof MCategoryElement) { - setCurrentPageAndPushHistory(nestedCategoryMPanelEntry.getKey().categoryFull()); - lastOpenCategory = nestedCategoryMPanelEntry.getKey(); - break; - } - } - } - for (Map.Entry nestedCategoryMPanelEntry : categoryMap.entrySet()) { - if (nestedCategoryMPanelEntry.getValue() instanceof MCollapsable) { - ((MCollapsable) nestedCategoryMPanelEntry.getValue()).setCollapsed(false); - } - } - rePlaceElements(); - } - }; - search.setPlaceHolder("Search..."); - add(search); - guiRelocate = new MButton(); - guiRelocate.setText("Edit Gui Locations"); - guiRelocate.setOnActionPerformed(() -> { - Minecraft.getMinecraft().displayGuiScreen(new GuiScreenAdapter(new GlobalHUDScale(new HUDLocationConfig(null)))); -