aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-05-21 21:18:14 +0900
committersyeyoung <cyoung06@naver.com>2022-05-21 21:28:52 +0900
commit20dd3f99a7b139b5848128246c622fd9cfefa478 (patch)
tree78e5f84ad22fd53876d488f6b58c3528aebe6501 /src/main/java/kr/syeyoung/dungeonsguide/config
parent50de034c046c4ddea033b73793c8825ecb5bb86f (diff)
downloadSkyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.gz
Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.tar.bz2
Skyblock-Dungeons-Guide-20dd3f99a7b139b5848128246c622fd9cfefa478.zip
- Project separation
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/Config.java65
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java40
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfigV2.java59
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategory.java103
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategoryElement.java82
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java154
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java113
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.java40
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MPanelCategory.java83
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameterEdit.java220
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java55
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java305
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java166
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java45
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java406
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java63
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.java82
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java53
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java39
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java42
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java39
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java52
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java39
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java39
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java53
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java39
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java52
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java55
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java55
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java29
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java54
31 files changed, 0 insertions, 2721 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java b/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java
deleted file mode 100644
index f8d60424..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/Config.java
+++ /dev/null
@@ -1,65 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-
-import java.io.*;
-
-public class Config {
- public static JsonObject configuration;
-
- public static File f;
-
- public static void loadConfig(File f) throws IOException {
- try {
- configuration = (JsonObject) new JsonParser().parse(new InputStreamReader(new FileInputStream(Config.f = f == null ? Config.f : f)));
- } catch (Exception e) {
- configuration = new JsonObject();
- }
- for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
- JsonObject object = configuration.getAsJsonObject(feature.getKey());
- if (object != null) feature.loadConfig(object);
- }
-
- saveConfig();
- }
-
- public static void saveConfig() throws IOException {
- for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
- JsonObject object = feature.saveConfig();
- configuration.add(feature.getKey(), object);
- }
-
- String str = new Gson().toJson(configuration);
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(f);
- BufferedWriter bos = new BufferedWriter(new OutputStreamWriter(fos));
- bos.write(str);
- bos.flush();
- } finally {
- fos.close();
- }
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/ConfigPanelCreator.java
deleted file mode 100644
index d02680bf..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class ConfigPanelCreator implements Function<String, MPanel> {
- public static final ConfigPanelCreator INSTANCE = new ConfigPanelCreator();
-
- public static final Map<String, Supplier<MPanel>> map = new HashMap<String, Supplier<MPanel>>();
-
- @Nullable
- @Override
- public MPanel apply(@Nullable String input) {
- if (!map.containsKey(input)) return null;
- return map.get(input).get();
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfigV2.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfigV2.java
deleted file mode 100644
index d1888283..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategory.java
deleted file mode 100644
index 77111fe7..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
-import kr.syeyoung.dungeonsguide.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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategoryElement.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MCategoryElement.java
deleted file mode 100644
index 22934fca..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.utils.RenderUtils;
-import kr.syeyoung.dungeonsguide.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 rooot) {
- this.category = category;
- this.onClick = onClick;
- this.leftPad = leftPad;
- this.offsetX = offsetX;
- this.rootConfigPanel = rooot;
- }
-
- @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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
deleted file mode 100644
index 49f637a5..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
+++ /dev/null
@@ -1,154 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.GuiFeature;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MButton;
-import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton;
-import kr.syeyoung.dungeonsguide.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<MPanel> addons = new ArrayList<MPanel>();
-
- @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 GuiFeature) {
- 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.setIsclicked(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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java
deleted file mode 100644
index f2ee35bc..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeatureEdit.java
+++ /dev/null
@@ -1,113 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureParameter;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MButton;
-import kr.syeyoung.dungeonsguide.gui.elements.MList;
-import kr.syeyoung.dungeonsguide.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<String, MPanel> 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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.java
deleted file mode 100644
index ef885487..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MNotFound.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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
-import org.lwjgl.opengl.GL11;
-
-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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MPanelCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MPanelCategory.java
deleted file mode 100644
index e2388c60..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameterEdit.java
deleted file mode 100644
index 6f791bcf..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import com.google.common.base.Predicates;
-import kr.syeyoung.dungeonsguide.config.types.AColor;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureParameter;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.*;
-import kr.syeyoung.dungeonsguide.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<FeatureParameter> isDisabled ;
-
- public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel) {
- this(abstractFeature, parameter, rootConfigPanel, (a) -> false);
- }
-
- public MParameterEdit(AbstractFeature abstractFeature, FeatureParameter parameter, RootConfigPanel rootConfigPanel, Predicate<FeatureParameter> 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<FeatureParameter> 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/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java
deleted file mode 100644
index a4812fb7..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/NestedCategory.java
+++ /dev/null
@@ -1,55 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-import lombok.experimental.Accessors;
-
-import java.util.HashMap;
-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<String, NestedCategory> children = new LinkedHashMap<>();
-
- public NestedCategory child(NestedCategory child) {
- this.children.put(child.categoryName, child);
- child.parent = this;
- return this;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java
deleted file mode 100644
index 1827d766..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/RootConfigPanel.java
+++ /dev/null
@@ -1,305 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig;
-
-import com.google.common.base.Function;
-import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.*;
-import kr.syeyoung.dungeonsguide.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<String, MPanel> pages = new HashMap<String, MPanel>();
- @Getter
- @Setter
- private Function<String, MPanel> 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<String> history = new Stack<String>();
-
- 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<NestedCategory, MPanel> nestedCategoryMPanelEntry : categoryMap.entrySet()) {
- if (nestedCategoryMPanelEntry.getValue() instanceof MCategoryElement) {
- setCurrentPageAndPushHistory(nestedCategoryMPanelEntry.getKey().categoryFull());
- lastOpenCategory = nestedCategoryMPanelEntry.getKey();
- break;
- }
- }
- }
- for (Map.Entry<NestedCategory, MPanel> 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 GuiGuiLocationConfig(gui, null));
- guiRelocate.setIsclicked(false);
- });
- guiRelocate.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67));
- add(guiRelocate);
-
- discord = new MButton(); github = new MButton();
- discord.setText("Discord"); github.setText("Github");
- discord.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67));
- github.setBorder(RenderUtils.blendTwoColors(0xFF141414,0x7702EE67));
- github.setOnActionPerformed(() -> {
- try {
- Desktop.getDesktop().browse(new URI("https://github.com/Dungeons-Guide/Skyblock-Dungeons-Guide/"));
- } catch (IOException | URISyntaxException e) {
- e.printStackTrace();
- }
- });
- discord.setOnActionPerformed(() -> {
- try {
- Desktop.getDesktop().browse(new URI("https://discord.gg/VuxayCWGE8"));
- } catch (IOException | URISyntaxException e) {
- e.printStackTrace();
- }
- });
- add(discord); add(github);
-
- navigationScroll = new MScrollablePanel(1);
- navigationScroll.setHideScrollBarWhenNotNecessary(false);
-
-
- add(navigationScroll);
- navigationScroll.add(navigation);
-
- contentScroll = new MScrollablePanel(3);
- contentScroll.setHideScrollBarWhenNotNecessary(true);
- add(contentScroll);
-
- setupNavigation();
- navigation.setGap(0);
- navigation.setDrawLine(false);
-
- setCurrentPageAndPushHistory("ROOT");
- rePlaceElements();
-
- search.setFocused(true);
- }
-
-
- private Map<NestedCategory, MPanel> categoryMap = new HashMap<>();
- private NestedCategory lastOpenCategory;
- private void setupNavigation() {
- categoryMap.clear();
- for (MPanel childComponent : navigation.getChildComponents()) {
- navigation.remove(childComponent);
- }
- NestedCategory root = new NestedCategory("ROOT");
- Set<String> categoryAllowed = new HashSet<>();
- String search = this.search.getText().trim().toLowerCase();
- for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
- if (search.isEmpty()) {
- categoryAllowed.add("ROOT."+abstractFeature.getCategory()+".");
- } else if (abstractFeature.getName().toLowerCase().contains(search)) {
- categoryAllowed.add("ROOT."+abstractFeature.getCategory()+".");
- } else if (abstractFeature.getDescription().toLowerCase().contains(search)) {
- categoryAllowed.add("ROOT."+abstractFeature.getCategory()+".");
- }
- }
- for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
- String category = abstractFeature.getCategory();
- boolean test =false;
- for (String s : categoryAllowed) {
- if (s.startsWith("ROOT."+category+".")) {
- test = true;
- break;
- }
- }
- if (!test) continue;
-
- NestedCategory currentRoot = root;
- 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));
- }
- }
-
- }
-
- for (NestedCategory value : root.children().values()) {
- setupNavigationRecursive(value, navigation, 0, 17);
- }
- ConfigPanelCreator.map.put("ROOT", () -> new MPanelCategory(root, this));
- }
- private void setupNavigationRecursive(NestedCategory nestedCategory, MPanel parent, int depth, int offset) {
- ConfigPanelCreator.map.put(nestedCategory.categoryFull(), () -> new MPanelCategory(nestedCategory, this));
-
- if (nestedCategory.children().size() == 0) {
- MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull(),() -> {
- setCurrentPageAndPushHistory(nestedCategory.categoryFull());
- lastOpenCategory = nestedCategory;
- }, 13 * depth + 17, offset, this);
- parent.add(current);
- categoryMap.put(nestedCategory, current);
- } else {
- MCategoryElement current = new MCategoryElement(nestedCategory.categoryFull(),() -> {
- setCurrentPageAndPushHistory(nestedCategory.categoryFull());
- lastOpenCategory = nestedCategory;
- }, 3,offset, this);
- MCollapsable mCollapsable = new MCollapsable(current, this::rePlaceElements);
- mCollapsable.setLeftPad(offset-13);
- mCollapsable.getLowerElements().setDrawLine(false);
- mCollapsable.getLowerElements().setGap(0);
- mCollapsable.setLeftPadElements(0);
- parent.add(mCollapsable);
- categoryMap.put(nestedCategory, mCollapsable);
-
- for (NestedCategory value : nestedCategory.children().values()) {
- setupNavigationRecursive(value, mCollapsable, depth+1, offset+13);
- }
- }
- }
-
-
- public void setCurrentPageAndPushHistory(String currentPage) {
- if (!this.currentPage.equals(currentPage))
- history.push(this.currentPage);
- lastOpenCategory = null;
- this.currentPage = currentPage;
- setupPage();
- }
- public void goBack() {
- if (history.size() == 0) return;
- this.currentPage = history.pop();
- setupPage();
- }
-
- private void setupPage() {
- contentScroll.getContentArea().getChildComponents().forEach(contentScroll.getContentArea()::remove);
- if (!pages.containsKey(currentPage)) {
- MPanel page = pageGenerator.apply(currentPage);
- if (page == null) page = new MNotFound();
- pages.put(currentPage, page);
- }
- contentScroll.getContentArea().add(pages.get(currentPage));
- rePlaceElements();
- }
-
- public void invalidatePage(String page) {
- pages.remove(page);
- if (page.equals(currentPage))
- setupPage();
- }
-
- @Override
- public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
- Dimension effectiveDim = getEffectiveDimension();
- Gui.drawRect(0,0, (int) (effectiveDim.width), (int) (effectiveDim.height), RenderUtils.blendAlpha(0x141414, 0.00f));
- Gui.drawRect(0,0, (int) (effectiveDim.width), 25, RenderUtils.blendAlpha(0x0, 0.20f));
-// Gui.drawRect(navigationScroll.getBounds().x + navigationScroll.getBounds().width - 10, 25, navigationScroll.getBounds().x + navigationScroll.getBounds().width , 50, RenderUtils.blendAlpha(0xFF141414, 0.04f));
- Gui.drawRect(0, 25,navigationScroll.getBounds().x + navigationScroll.getBounds().width , 50, RenderUtils.blendAlpha(0xFF141414, 0.08f));
-
-
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- fr.drawString("DungeonsGuide By syeyoung", (effectiveDim.width - fr.getStringWidth("DungeonsGuide By syeyoung"))/2, (25 - fr.FONT_HEIGHT)/2, 0xFF02EE67);
- }
-
- @Override
- public void render0(double parentScale, Point parentPoint, Rectangle parentClip, int absMousex0, int absMousey0, int relMousex0, int relMousey0, float partialTicks) {
- super.render0(parentScale, parentPoint, parentClip, absMousex0, absMousey0, relMousex0, relMousey0, partialTicks);
- Dimension effectiveDim = getEffectiveDimension();
- Gui.drawRect(0,24, (int) (Double.min(1, (System.currentTimeMillis() - lastPageSet)/1000.0) * effectiveDim.width), 25, 0xFF02EE67);
- }
-
- @Override
- public void setBounds(Rectangle bounds) {
- super.setBounds(bounds);
- rePlaceElements();
- }
-
- @Override
- public void setScale(double scale) {
- super.setScale(scale);
- rePlaceElements();
- }
-
- private void rePlaceElements() {
- Dimension effectiveDim = getEffectiveDimension();
-
- navigation.setBounds(new Rectangle(new Point(0,1), new Dimension(Math.max(100, Math.max(navigation.getPreferredSize().width, navigationScroll.getBounds().width-10)), navigation.getPreferredSize().height)));
- navigation.realignChildren();
-
- navigationScroll.evalulateContentArea();
- Rectangle navBound;
- navigationScroll.setBounds(navBound = new Rectangle(0,50, navigation.getBounds().width+10, effectiveDim.height-50));
- contentScroll.setBounds(new Rectangle(navBound.x + navBound.width, 25, effectiveDim.width - navBound.x - navBound.width, effectiveDim.height-25));
-
- search.setBounds(new Rectangle(5,30,navBound.x + navBound.width - 10,15));
-
- guiRelocate.setBounds(new Rectangle(5,5,100,15));
- github.setBounds(new Rectangle(effectiveDim.width - 80,5,75,15));
- discord.setBounds(new Rectangle(effectiveDim.width - 160,5,75,15));
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java
deleted file mode 100755
index 48c046c3..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/GuiGuiLocationConfig.java
+++ /dev/null
@@ -1,166 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.location;
-
-import kr.syeyoung.dungeonsguide.features.AbstractFeature;
-import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
-import kr.syeyoung.dungeonsguide.features.GuiFeature;
-import kr.syeyoung.dungeonsguide.gui.MGui;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import lombok.Getter;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.util.Vec3;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.io.IOException;
-import java.util.*;
-import java.util.List;
-
-public class GuiGuiLocationConfig extends MGui {
-
- @Getter
- private final GuiScreen before;
-
- @Getter
- private TreeMap<Integer, List<Marker>> markerTreeMapByX = new TreeMap<>();
- @Getter
- private TreeMap<Integer, List<Marker>> markerTreeMapByY = new TreeMap<>();
- @Getter
- private Set<Marker> markerSet = new HashSet<>();
-
-
- Marker[] markers = new Marker[4];
-
-
- public GuiGuiLocationConfig(final GuiScreen before, AbstractFeature featureWhitelist) {
- this.before = before;
- for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
- if (feature instanceof GuiFeature && feature.isEnabled()) {
- getMainPanel().add(new PanelDelegate((GuiFeature) feature, featureWhitelist == null || feature == featureWhitelist, this));
- }
- }
-
- getMainPanel().setBackgroundColor(new Color(0,0,0, 100));
- }
-
- public static final Vec3[] facing = new Vec3[] {
- new Vec3(0, 0.5, 2),
- new Vec3(0.5, 0, 1),
- new Vec3(0.5, 1, 3),
- new Vec3(1, 0.5, 4),
- };
-
- public void removeAndAddMarker(Marker prev, Marker newM) {
- if (prev != null) {
- markerTreeMapByX.computeIfPresent(prev.getX(),(k,v) -> {
- v.remove(prev);
- if (v.isEmpty()) return null;
- else return v;
- });
- markerTreeMapByY.computeIfPresent(prev.getY(),(k,v) -> {
- v.remove(prev);
- if (v.isEmpty()) return null;
- else return v;
- });
- markerSet.remove(prev);
- }
- if (newM != null) {
- markerTreeMapByX.compute(newM.getX(), (k,v) -> {
- if (v == null) {
- return new ArrayList<>(Arrays.asList(newM));
- } else {
- v.add(newM);
- return v;
- }
- });
- markerTreeMapByY.compute(newM.getY(), (k,v) -> {
- if (v == null) {
- return new ArrayList<>(Arrays.asList(newM));
- } else {
- v.add(newM);
- return v;
- }
- });
- markerSet.add(newM);
- }
- }
-
- public void setupMarkers() {
- for (int i1 = 0; i1 < markers.length; i1++) {
- Marker orig = markers[i1];
- Vec3 pt = facing[i1];
- markers[i1] = new Marker((int) (pt.xCoord * getMainPanel().getBounds().width), (int) (pt.yCoord * getMainPanel().getBounds().height), (int) pt.zCoord, this);
-
- removeAndAddMarker(orig, markers[i1]);
- }
- }
-
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- GlStateManager.pushMatrix();
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GlStateManager.translate(scaledResolution.getScaledWidth()/2, scaledResolution.getScaledHeight()/2, 0);
- FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- GlStateManager.enableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
- GlStateManager.color(1, 1, 1, 1);
- fr.drawString("Right Click On Elements to Open Popup Menu",
- -fr.getStringWidth("Right Click On Elements to Open Popup Menu")/2
- ,-fr.FONT_HEIGHT/2, -1);
- GlStateManager.popMatrix();
- super.drawScreen(mouseX, mouseY, partialTicks);
- }
-
- @Override
- public void keyTyped(char typedChar, int keyCode) throws IOException {
- try {
- getMainPanel().keyPressed0(typedChar, keyCode);
-
- if (keyCode == 1) {
- Minecraft.getMinecraft().displayGuiScreen(before);
- }
- } catch (Throwable e) {
- if (!e.getMessage().contains("hack to stop"))
- e.printStackTrace();
- }
- }
-
- @Override
- public void initGui() {
- super.initGui();
- getMainPanel().setBounds(new Rectangle(0,0,Minecraft.getMinecraft().displayWidth,Minecraft.getMinecraft().displayHeight));
- markerTreeMapByX.clear();
- markerTreeMapByY.clear();
- markerSet.clear();
- setupMarkers();
- for (MPanel childComponent : getMainPanel().getChildComponents()) {
- if (childComponent instanceof PanelDelegate) {
- ((PanelDelegate) childComponent).rebuildMarker();
- }
- }
-
- }
-
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java
deleted file mode 100644
index 7a0b9c58..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/Marker.java
+++ /dev/null
@@ -1,45 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.location;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.ToString;
-
-@Getter
-@ToString
-@AllArgsConstructor
-public class Marker {
- private final int x;
- private final int y;
- /**
- * 0xABCDEFGH
- * A: ?
- * B: ?
- * C: ?
- * D: ?
- * EF: 0~3 (TC 0x00 CL 0x01 BC 0x10 CR 0x11)
- */
- private final int type;
- private final Object parent;
-
- public int distanceSQ(Marker m2) {
- return (m2.x - x)*(m2.x - x) + (m2.y - y)*(m2.y - y);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java
deleted file mode 100644
index d34eb6c1..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/location/PanelDelegate.java
+++ /dev/null
@@ -1,406 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.guiconfig.location;
-
-import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig;
-import kr.syeyoung.dungeonsguide.config.guiconfig.location.Marker;
-import kr.syeyoung.dungeonsguide.config.types.GUIRectangle;
-import kr.syeyoung.dungeonsguide.features.GuiFeature;
-import kr.syeyoung.dungeonsguide.gui.MPanel;
-import kr.syeyoung.dungeonsguide.gui.elements.MPopupMenu;
-import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
-import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.WorldRenderer;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.util.EnumFacing;
-import net.minecraft.util.Tuple;
-import net.minecraft.util.Vec3;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-
-public class PanelDelegate extends MPanel {
- private final GuiFeature guiFeature;
- private boolean draggable = false;
- private GuiGuiLocationConfig guiGuiLocationConfig;
-
- private Set<Marker> markerSet = new HashSet<>();
- public PanelDelegate(GuiFeature guiFeature, boolean draggable, GuiGuiLocationConfig guiGuiLocationConfig) {
- this.guiFeature = guiFeature;
- this.draggable = draggable;
- this.guiGuiLocationConfig = guiGuiLocationConfig;
- }
-
- public void rebuildMarker() {
- internallyThinking = guiFeature.getFeatureRect().getRectangleNoScale();
- applyConstraint();
- }
-
- @Override
- public Rectangle getBounds() {
- Rectangle rectangle = guiFeature.getFeatureRect().getRectangle();
- return new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
- }
-
- @Override
- public void render(int absMousex, int absMousey, int relMouseX, int relMouseY, float partialTicks, Rectangle scissor) {
- if (!guiFeature.isEnabled()) return;
-
- GlStateManager.pushMatrix();
- guiFeature.drawDemo(partialTicks);
- GlStateManager.popMatrix();
- if (!draggable) return;
- Gui.drawRect(0,0, 4, 4, 0xFFBBBBBB);
- Gui.drawRect(0, getBounds().height - 4, 4, getBounds().height, 0xFFBBBBBB);
- Gui.drawRect(getBounds().width - 4,0, getBounds().width, 4, 0xFFBBBBBB);
- Gui.drawRect(getBounds().width - 4,getBounds().height - 4, getBounds().width, getBounds().height, 0xFFBBBBBB);
- if (lastAbsClip.contains(absMousex, absMousey)) {
- if (relMouseX < 4 && relMouseY < 4) {
- Gui.drawRect(0,0, 4, 4, 0x55FFFFFF);
- } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) {
- Gui.drawRect(0, getBounds().height - 4, 4, getBounds().height, 0x55FFFFFF);
- } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) {
- Gui.drawRect(getBounds().width - 4,getBounds().height - 4, getBounds().width, getBounds().height, 0x55FFFFFF);
- } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) {
- Gui.drawRect(getBounds().width - 4,0, getBounds().width, 4, 0x55FFFFFF);
- } else if (selectedPart == -2){
- Gui.drawRect(0,0, getBounds().width, getBounds().height, 0x55FFFFFF);
- }
- }
- GlStateManager.enableBlend();
- }
-
- @Override
- public void render0(double scale, Point parentPoint, Rectangle parentClip, int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks) {
- GlStateManager.pushMatrix();
- super.render0(scale, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks);
- GlStateManager.popMatrix();
-
- if (snapped != null && selectedPart != -2) {
- Tessellator tessellator = Tessellator.getInstance();
- GlStateManager.disableTexture2D();
- WorldRenderer worldRenderer = tessellator.getWorldRenderer();
- worldRenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
- GL11.glLineWidth(1);
- for (Tuple<Marker[], EnumFacing.Axis> markerAxisTuple : snapped) {
- if (markerAxisTuple.getSecond() == EnumFacing.Axis.X) {
- worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), 0, 0).color(0,255,0,255).endVertex();
- worldRenderer.pos(markerAxisTuple.getFirst()[0].getX(), Minecraft.getMinecraft().displayHeight, 0).color(0,255,0,255).endVertex();
- } else {
- worldRenderer.pos(0, markerAxisTuple.getFirst()[0].getY(), 0).color(0,255,0,255).endVertex();
- worldRenderer.pos(Minecraft.getMinecraft().displayWidth, markerAxisTuple.getFirst()[0].getY(), 0).color(0,255,0,255).endVertex();
- }
- }
- tessellator.draw();
- for (Marker marker : guiGuiLocationConfig.getMarkerSet()) {
- Gui.drawRect(marker.getX(),marker.getY(), marker.getX()+1, marker.getY()+1, 0xFFFF0000);
- }
- }
- }
-
- private int selectedPart = -2;
-
- private int lastX = 0;
- private int lastY = 0;
-
- private Rectangle internallyThinking;
- private Rectangle constraintApplied;
-
- private Set<Tuple<Marker[], EnumFacing.Axis>> snapped = new HashSet<>();
-
- public void applyConstraint() {
- constraintApplied = internallyThinking.getBounds();
-
- // SNAP Moving Point.
- snapped.clear();
- int scailingThreshold = 5;
- if (selectedPart == 0){
- Point snapPt = new Point(constraintApplied.x +constraintApplied.width, constraintApplied.y + constraintApplied.height);
- Optional<Marker> snapX, snapY;
- SortedMap<Integer, List<Marker>> markerSortedMap = guiGuiLocationConfig.getMarkerTreeMapByX().subMap(snapPt.x-scailingThreshold, snapPt.x +scailingThreshold);
- snapX = markerSortedMap.values().stream()
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .filter(a -> a.getParent() != this)
- .min(Comparator.comparingInt(a -> (int) snapPt.distanceSq(a.getX(), a.getY())));
- markerSortedMap = guiGuiLocationConfig.getMarkerTreeMapByY().subMap(snapPt.y-scailingThreshold, snapPt.y +scailingThreshold);
- snapY = markerSortedMap.values().stream()
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .filter(a -> a.getParent() != this)
- .min(Comparator.comparingInt(a -> (int) snapPt.distanceSq(a.getX(), a.getY())));
- snapX.ifPresent(a -> {
- snapPt.x = a.getX();
- });
- snapY.ifPresent(a -> {
- snapPt.y = a.getY();
- });
-
- constraintApplied = new Rectangle(constraintApplied.x, constraintApplied.y, snapPt.x - constraintApplied.x, snapPt.y - constraintApplied.y);
-
-
-
- int minWidth;
- int minHeight;
- if (guiFeature.isKeepRatio()) {
- if (guiFeature.getDefaultRatio() >= 1) {
- minHeight = constraintApplied.height < 0 ? -8 : 8;
- minWidth = (int) (guiFeature.getDefaultRatio() * minHeight);
- } else {
- minWidth = constraintApplied.width < 0 ? -8 : 8;
- minHeight = (int) (minWidth / guiFeature.getDefaultRatio());
- }
- } else {
- minWidth = constraintApplied.width < 0 ? -8 : 8;
- minHeight = constraintApplied.height < 0 ? -8 : 8;
- }
-
-
- constraintApplied.width = Math.abs(constraintApplied.width) > Math.abs(minWidth) ? constraintApplied.width :
- Math.abs(internallyThinking.width) > Math.abs(minWidth) ? internallyThinking.width : minWidth;
- constraintApplied.height = Math.abs(constraintApplied.height) > Math.abs(minHeight) ? constraintApplied.height :
- Math.abs(internallyThinking.height) > Math.abs(minHeight) ? internallyThinking.height : minHeight;
-
- if (guiFeature.isKeepRatio()) {
- double ratio = guiFeature.getDefaultRatio();
-
- int heightWhenWidthFix = (int) Math.abs(constraintApplied.width / ratio);
- int widthWhenHeightFix = (int) Math.abs(ratio * constraintApplied.height);
- if (Math.abs(heightWhenWidthFix) <= Math.abs(constraintApplied.height)) {
- constraintApplied.height = constraintApplied.height < 0 ? -heightWhenWidthFix : heightWhenWidthFix;
- } else if (Math.abs(widthWhenHeightFix) <= Math.abs(constraintApplied.width)) {
- constraintApplied.width =constraintApplied.width < 0 ? - widthWhenHeightFix : widthWhenHeightFix;
- }
- }
-
-
- snapX.ifPresent(a -> {
- if (snapPt.x - constraintApplied.x == constraintApplied.width) {
- Marker m = new Marker((int) (GuiGuiLocationConfig.facing[3].xCoord * constraintApplied.width) + constraintApplied.x, (int) (GuiGuiLocationConfig.facing[3].yCoord * constraintApplied.height) + constraintApplied.y, (int) GuiGuiLocationConfig.facing[3].zCoord, this);
- snapped.add(new Tuple<>(new Marker[]{a, m}, EnumFacing.Axis.X));
- }
- });
- snapY.ifPresent(a -> {
- if (snapPt.y - constraintApplied.y == constraintApplied.height) {
- Marker m = new Marker((int) (GuiGuiLocationConfig.facing[2].xCoord * constraintApplied.width) + constraintApplied.x, (int) (GuiGuiLocationConfig.facing[2].yCoord * constraintApplied.height) + constraintApplied.y, (int) GuiGuiLocationConfig.facing[2].zCoord, this);
- snapped.add(new Tuple<>(new Marker[]{a, m}, EnumFacing.Axis.Y));
- }
- });
-
- if (constraintApplied.height < 0) {
- constraintApplied.height = -constraintApplied.height;
- constraintApplied.y -= constraintApplied.height;
- }
-
- if (constraintApplied.width < 0) {
- constraintApplied.width = -constraintApplied.width;
- constraintApplied.x -= constraintApplied.width;
- }
- } else if (selectedPart == -1) {
- for (int i : Arrays.asList(0,3,1,2)) {
- Vec3 pt = GuiGuiLocationConfig.facing[i];
- Marker m = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
- Optional<Marker> result = guiGuiLocationConfig.getMarkerTreeMapByX().subMap(m.getX()-scailingThreshold, m.getX() +scailingThreshold).values().stream()
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .filter(a -> a.getParent() != this)
- .filter(a -> Math.abs(a.getX() - m.getX()) < scailingThreshold)
- .filter(a -> ((a.getX() - pt.xCoord * constraintApplied.width) >= 0
- && (a.getX() - pt.xCoord * constraintApplied.width + constraintApplied.width) <= Minecraft.getMinecraft().displayWidth))
- .min(Comparator.comparingInt(a -> a.distanceSQ(m)));
- if (result.isPresent()) {
- int x = result.get().getX();
- constraintApplied.x = (int) (x - pt.xCoord * constraintApplied.width);
-
- snapped.add(new Tuple<>(new Marker[] {result.get(), m}, EnumFacing.Axis.X));
- break;
- }
- }
- for (int i : Arrays.asList(1,2,0,3)) {
- Vec3 pt = GuiGuiLocationConfig.facing[i];
- Marker m = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
- Optional<Marker> result = guiGuiLocationConfig.getMarkerTreeMapByY().subMap(m.getY()-scailingThreshold, m.getY() +scailingThreshold).values().stream()
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .filter(a -> a.getParent() != this)
- .filter(a -> Math.abs(a.getY() - m.getY()) < scailingThreshold)
- .filter(a -> ((a.getY() - pt.yCoord * constraintApplied.height) >= 0
- && (a.getY() - pt.yCoord * constraintApplied.height+ constraintApplied.height) <= Minecraft.getMinecraft().displayHeight))
- .min(Comparator.comparingInt(a -> a.distanceSQ(m)));
- if (result.isPresent()) {
- int y = result.get().getY();
- constraintApplied.y = (int) (y - pt.yCoord * constraintApplied.height);
- snapped.add(new Tuple<>(new Marker[] {result.get(), m}, EnumFacing.Axis.Y));
- break;
- }
- }
- }
-
- if (constraintApplied.x < 0) constraintApplied.x = 0;
- if (constraintApplied.y < 0) constraintApplied.y = 0;
- if (constraintApplied.x + constraintApplied.width + 1 >=Minecraft.getMinecraft().displayWidth) constraintApplied.x = Minecraft.getMinecraft().displayWidth - constraintApplied.width - 1;
- if (constraintApplied.y + constraintApplied.height + 1>= Minecraft.getMinecraft().displayHeight) constraintApplied.y = Minecraft.getMinecraft().displayHeight - constraintApplied.height - 1;
-
-
- setupMarkers();
- }
-
- Marker[] markers = new Marker[4];
- public void setupMarkers() {
- for (int i1 = 0; i1 < markers.length; i1++) {
- Marker orig = markers[i1];
-
- Vec3 pt = GuiGuiLocationConfig.facing[i1];
- markers[i1] = new Marker((int) (pt.xCoord * constraintApplied.width) + constraintApplied.x, (int) (pt.yCoord * constraintApplied.height) + constraintApplied.y, (int) pt.zCoord, this);
-
- guiGuiLocationConfig.removeAndAddMarker(orig, markers[i1]);
- }
- }
-
- MTooltip mTooltip;
-
- @Override
- public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
- if (!draggable) return;
- if (!guiFeature.isEnabled()) return;
- if (getTooltipsOpen() > 0) return;
- if (!lastAbsClip.contains(absMouseX, absMouseY)) return;
- if (mouseButton == 0) {
- internallyThinking = guiFeature.getFeatureRect().getRectangleNoScale();
- if (relMouseX < 4 && relMouseY < 4) { // TL
- selectedPart = 0;
- internallyThinking.y += internallyThinking.height;
- internallyThinking.height = -internallyThinking.height;
- internallyThinking.x += internallyThinking.width;
- internallyThinking.width = -internallyThinking.width;
- } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) { // BL
- selectedPart = 0;
- internallyThinking.x += internallyThinking.width;
- internallyThinking.width = -internallyThinking.width;
- } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) { // BR
- selectedPart = 0;
- } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) { // TR
- selectedPart = 0;
- internallyThinking.y += internallyThinking.height;
- internallyThinking.height = -internallyThinking.height;
- } else {
- selectedPart = -1;
- }
- lastX = absMouseX;
- lastY = absMouseY;
- applyConstraint();
-
- } else if (getTooltipsOpen() == 0){
- if (mTooltip != null) mTooltip.close();
- mTooltip = new MPopupMenu(absMouseX, absMouseY, guiFeature.getTooltipForEditor(guiGuiLocationConfig));
- mTooltip.setScale(2.0f);
- mTooltip.open(this);
- }
- throw new IllegalArgumentException("bruh, a hack to stop event progress");
- }
-
- @Override
- public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
- if (!draggable) return;
- if (!guiFeature.isEnabled()) return;
- if (selectedPart >= -1) {
- guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
- }
-
- selectedPart = -2;
- }
-
- @Override
- public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
- if (!draggable) return;
- if (!guiFeature.isEnabled()) return;
- int dx = (absMouseX - lastX);
- int dy = (absMouseY - lastY);
- if (selectedPart >= 0) {
- Rectangle rectangle = internallyThinking;
-
- int prevWidth = rectangle.width;
- int prevHeight= rectangle.height;
-
- rectangle.width = prevWidth + dx;
- rectangle.height = prevHeight + dy;
-
- if (rectangle.height * prevHeight <= 0 && prevHeight != rectangle.height) {
- rectangle.height += prevHeight < 0 ? 4 : -4;
- }
- if (rectangle.width * prevWidth <= 0 && prevWidth != rectangle.width) {
- rectangle.width += prevWidth < 0 ? 4 : -4;
- }
-
-
- applyConstraint();
- guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
- lastX = absMouseX;
- lastY = absMouseY;
- throw new IllegalArgumentException("bruh, a hack to stop event progress");
- } else if (selectedPart == -1){
- Rectangle rectangle = internallyThinking;
- rectangle.translate(dx, dy);
- applyConstraint();
- guiFeature.setFeatureRect(new GUIRectangle(constraintApplied));
- lastX = absMouseX;
- lastY = absMouseY;
- }
- }
-
- @Override
- public void mouseMoved(int absMouseX, int absMouseY, int relMouseX, int relMouseY) {
- if (!draggable) return;
- if (!guiFeature.isEnabled()) return;
- if (getTooltipsOpen() > 0) return;
-
- if (selectedPart == -1) {
- setCursor(EnumCursor.CLOSED_HAND);
- } else if (selectedPart >= 0) {
- if (internallyThinking.width < 0 && internallyThinking.height < 0) {
- setCursor(EnumCursor.RESIZE_TL);
- } else if (internallyThinking.width < 0 && internallyThinking.height >= 0) {
- setCursor(EnumCursor.RESIZE_DL);
- } else if (internallyThinking.width >= 0 && internallyThinking.height >= 0) {
- setCursor(EnumCursor.RESIZE_DR);
- } else if (internallyThinking.width >= 0 && internallyThinking.height < 0) {
- setCursor(EnumCursor.RESIZE_TR);
- }
- } else if (lastAbsClip.contains(absMouseX, absMouseY)) {
- if (relMouseX < 4 && relMouseY < 4) {
- setCursor(EnumCursor.RESIZE_TL);
- } else if (relMouseX < 4 && relMouseY > getBounds().height - 4) {
- setCursor(EnumCursor.RESIZE_DL);
- } else if (relMouseX > getBounds().width - 4 && relMouseY > getBounds().height - 4) {
- setCursor(EnumCursor.RESIZE_DR);
- } else if (relMouseX > getBounds().width - 4 && relMouseY < 4) {
- setCursor(EnumCursor.RESIZE_TR);
- } else {
- setCursor(EnumCursor.OPEN_HAND);
- }
- }
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
deleted file mode 100644
index c9f464df..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java
+++ /dev/null
@@ -1,63 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.awt.*;
-
-@Getter
-@Setter
-public class AColor extends Color {
- private boolean chroma;
- private float chromaSpeed;
-
- public AColor(int r, int g, int b, int a) {
- super(r, g, b, a);
- }
-
- public AColor(int rgba, boolean hasalpha) {
- super(rgba, hasalpha);
- }
-
- public AColor(AColor clone) {
- super(clone.getRGB(), true);
- chroma = clone.isChroma();
- chromaSpeed = clone.getChromaSpeed();
- }
-
- public AColor multiplyAlpha(double multiplier) {
- AColor aColor = new AColor(getRed(), getGreen(), getBlue(), (int) (getAlpha() * multiplier));
- aColor.chroma = this.chroma;
- aColor.chromaSpeed = this.chromaSpeed;
- return aColor;
- }
-
- @Override
- public String toString() {
- return "AColor{" +
- ", r="+getRed()+
- ", g="+getGreen()+
- ", b="+getBlue()+
- ", a="+getAlpha()+
- ", chromaSpeed=" + chromaSpeed +
- '}';
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.java
deleted file mode 100644
index 1c129d2e..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/GUIRectangle.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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
-
-import java.awt.*;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class GUIRectangle {
- public GUIRectangle(Rectangle rectangle) {
- if (rectangle.x < Minecraft.getMinecraft().displayWidth / 2) {
- this.x = rectangle.x;
- this.width = rectangle.width;
- } else {
- this.x = rectangle.x + rectangle.width - Minecraft.getMinecraft().displayWidth;
- this.width = -rectangle.width;
- }
-
- if (rectangle.y < Minecraft.getMinecraft().displayHeight / 2) {
- this.y = rectangle.y;
- this.height = rectangle.height;
- } else {
- this.y = rectangle.y +rectangle.height - Minecraft.getMinecraft().displayHeight;
- this.height = -rectangle.height;
- }
- }
-
- private int x;
- private int y;
- private int width;
- private int height;
-
- public Rectangle getRectangle() {
- return getRectangleNoScale();
- }
-// public Rectangle getRectangle(ScaledResolution scaledResolution) {
-// double realX = (int) (x < 0 ? scaledResolution.getScaledWidth() + x : x);
-// double realY = (int) (y < 0 ? scaledResolution.getScaledHeight() + y : y);
-//
-// return new Rectangle((int)Math.min(realX + width, realX), (int)Math.min(realY + height, realY),
-// (int)Math.abs(width), (int)Math.abs(height));
-// }
- public Rectangle getRectangleNoScale() {
- int x = this.x, y = this.y;
- if (Math.abs(x) > Minecraft.getMinecraft().displayWidth / 2) {
- x = x < 0 ? -Minecraft.getMinecraft().displayWidth/2 : Minecraft.getMinecraft().displayWidth/2;
- }
- if (Math.abs(y) > Minecraft.getMinecraft().displayHeight / 2) {
- y = y < 0 ? -Minecraft.getMinecraft().displayHeight/2 : Minecraft.getMinecraft().displayHeight/2;
- }
-
-
- double realX = (int) (x < 0 ? Minecraft.getMinecraft().displayWidth + x : x);
- double realY = (int) (y < 0 ? Minecraft.getMinecraft().displayHeight + y : y);
-
- return new Rectangle((int)Math.min(realX + width, realX), (int)Math.min(realY + height, realY),
- (int)Math.abs(width), (int)Math.abs(height));
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
deleted file mode 100644
index 33748a8b..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java
+++ /dev/null
@@ -1,53 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
-import java.awt.*;
-
-public class TCAColor implements TypeConverter<AColor> {
- @Override
- public String getTypeString() {
- return "acolor";
- }
-
- @Override
- public AColor deserialize(JsonElement element) {
- if (element instanceof JsonPrimitive)
- return new AColor(element.getAsInt(), true);
-
- JsonObject object = element.getAsJsonObject();
- AColor color = new AColor(object.get("color").getAsInt(), true);
- color.setChroma(object.get("chroma").getAsBoolean());
- color.setChromaSpeed(object.get("chromaSpeed").getAsFloat());
- return color;
- }
-
- @Override
- public JsonElement serialize(AColor element) {
- JsonObject object = new JsonObject();
- object.addProperty("color", element.getRGB());
- object.addProperty("chroma", element.isChroma());
- object.addProperty("chromaSpeed", element.getChromaSpeed());
- return object;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java
deleted file mode 100644
index 15a26d0f..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCBoolean.java
+++ /dev/null
@@ -1,39 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-public class TCBoolean implements TypeConverter<Boolean> {
- @Override
- public String getTypeString() {
- return "boolean";
- }
-
- @Override
- public Boolean deserialize(JsonElement element) {
- return element.getAsBoolean();
- }
-
- @Override
- public JsonElement serialize(Boolean element) {
- return new JsonPrimitive(element);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java
deleted file mode 100644
index 6014b122..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCColor.java
+++ /dev/null
@@ -1,42 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
-import java.awt.*;
-
-public class TCColor implements TypeConverter<Color> {
- @Override
- public String getTypeString() {
- return "color";
- }
-
- @Override
- public Color deserialize(JsonElement element) {
- return new Color(element.getAsInt());
- }
-
- @Override
- public JsonElement serialize(Color element) {
- return new JsonPrimitive(element.getRGB());
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java
deleted file mode 100644
index 0890f350..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCFloat.java
+++ /dev/null
@@ -1,39 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-public class TCFloat implements TypeConverter<Float> {
- @Override
- public String getTypeString() {
- return "float";
- }
-
- @Override
- public Float deserialize(JsonElement element) {
- return element.getAsFloat();
- }
-
- @Override
- public JsonElement serialize(Float element) {
- return new JsonPrimitive(element);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java
deleted file mode 100644
index 8880a628..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCGUIRectangle.java
+++ /dev/null
@@ -1,52 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-
-import java.awt.*;
-
-public class TCGUIRectangle implements TypeConverter<GUIRectangle> {
- @Override
- public String getTypeString() {
- return "guirect";
- }
-
- @Override
- public GUIRectangle deserialize(JsonElement element) {
- if (element == null) return null;
- GUIRectangle rectangle = new GUIRectangle();
- rectangle.setX(((JsonObject)element).get("x").getAsInt());
- rectangle.setY(((JsonObject)element).get("y").getAsInt());
- rectangle.setWidth(((JsonObject)element).get("width").getAsInt());
- rectangle.setHeight(((JsonObject)element).get("height").getAsInt());
- return rectangle;
- }
-
- @Override
- public JsonElement serialize(GUIRectangle element) {
- JsonObject object = new JsonObject();
- object.addProperty("x", element.getX());
- object.addProperty("y", element.getY());
- object.addProperty("width", element.getWidth());
- object.addProperty("height", element.getHeight());
- return object;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java
deleted file mode 100644
index 2a066921..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCInteger.java
+++ /dev/null
@@ -1,39 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-public class TCInteger implements TypeConverter<Integer> {
- @Override
- public String getTypeString() {
- return "integer";
- }
-
- @Override
- public Integer deserialize(JsonElement element) {
- return element.getAsInt();
- }
-
- @Override
- public JsonElement serialize(Integer element) {
- return new JsonPrimitive(element);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java
deleted file mode 100644
index 4ae89395..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCKeybind.java
+++ /dev/null
@@ -1,39 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-public class TCKeybind implements TypeConverter<Integer> {
- @Override
- public String getTypeString() {
- return "keybind";
- }
-
- @Override
- public Integer deserialize(JsonElement element) {
- return element.getAsInt();
- }
-
- @Override
- public JsonElement serialize(Integer element) {
- return new JsonPrimitive(element);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java
deleted file mode 100644
index ba778872..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCRectangle.java
+++ /dev/null
@@ -1,53 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import org.w3c.dom.css.Rect;
-
-import java.awt.*;
-
-public class TCRectangle implements TypeConverter<Rectangle> {
- @Override
- public String getTypeString() {
- return "rect";
- }
-
- @Override
- public Rectangle deserialize(JsonElement element) {
- Rectangle rectangle = new Rectangle();
- rectangle.x = ((JsonObject)element).get("x").getAsInt();
- rectangle.y = ((JsonObject)element).get("y").getAsInt();
- rectangle.width = ((JsonObject)element).get("width").getAsInt();
- rectangle.height = ((JsonObject)element).get("height").getAsInt();
- return rectangle;
- }
-
- @Override
- public JsonElement serialize(Rectangle element) {
- JsonObject object = new JsonObject();
- object.addProperty("x", element.x);
- object.addProperty("y", element.y);
- object.addProperty("width", element.width);
- object.addProperty("height", element.height);
- return object;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java
deleted file mode 100644
index a90bedc6..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCString.java
+++ /dev/null
@@ -1,39 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-public class TCString implements TypeConverter<String> {
- @Override
- public String getTypeString() {
- return "string";
- }
-
- @Override
- public String deserialize(JsonElement element) {
- return element.getAsString();
- }
-
- @Override
- public JsonElement serialize(String element) {
- return new JsonPrimitive(element);
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java
deleted file mode 100644
index 0a3e6217..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCStringList.java
+++ /dev/null
@@ -1,52 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-public class TCStringList implements TypeConverter<List<String>> {
- @Override
- public String getTypeString() {
- return "stringlist";
- }
-
- @Override
- public List<String> deserialize(JsonElement element) {
- List<String> strList = new ArrayList<>();
- for (JsonElement jsonElement : element.getAsJsonArray()) {
- strList.add(jsonElement.getAsString());
- }
- return strList;
- }
-
- @Override
- public JsonElement serialize(List<String> element) {
- JsonArray jsonElements = new JsonArray();
- for (String s : element) {
- jsonElements.add(new JsonPrimitive(s));
- }
- return jsonElements;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
deleted file mode 100644
index d27b311e..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyle.java
+++ /dev/null
@@ -1,55 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import kr.syeyoung.dungeonsguide.features.text.TextStyle;
-
-import java.util.List;
-
-public class TCTextStyle implements TypeConverter<TextStyle> {
- @Override
- public String getTypeString() {
- return "textstyle";
- }
-
- @Override
- public TextStyle deserialize(JsonElement element) {
- TextStyle textStyle = new TextStyle();
- textStyle.setColor(TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("color")));
- textStyle.setBackground(element.getAsJsonObject().has("background") ? TypeConverterRegistry.getTypeConverter("acolor", AColor.class).deserialize(element.getAsJsonObject().get("background"))
- : new AColor(0x00777777, true));
- textStyle.setGroupName(element.getAsJsonObject().get("group").getAsString());
- if (element.getAsJsonObject().has("shadow"))
- textStyle.setShadow(element.getAsJsonObject().get("shadow").getAsBoolean());
- return textStyle;
- }
-
- @Override
- public JsonElement serialize(TextStyle element) {
- JsonObject jsonObject = new JsonObject();
- jsonObject.add("color", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getColor()));
- jsonObject.add("background", TypeConverterRegistry.getTypeConverter("acolor", AColor.class).serialize(element.getBackground()));
- jsonObject.addProperty("group", element.getGroupName());
- jsonObject.addProperty("shadow", element.isShadow());
- return jsonObject;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
deleted file mode 100644
index e9721ab7..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCTextStyleList.java
+++ /dev/null
@@ -1,55 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-import kr.syeyoung.dungeonsguide.features.text.TextStyle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TCTextStyleList implements TypeConverter<List<TextStyle>> {
- @Override
- public String getTypeString() {
- return "list_textStyle";
- }
-
- @Override
- public List<TextStyle> deserialize(JsonElement element) {
- JsonArray arr = element.getAsJsonArray();
- TypeConverter<TextStyle> conv = TypeConverterRegistry.getTypeConverter("textstyle", TextStyle.class);
- List<TextStyle> texts = new ArrayList<TextStyle>();
- for (JsonElement element2:arr) {
- texts.add(conv.deserialize(element2));
- }
- return texts;
- }
-
- @Override
- public JsonElement serialize(List<TextStyle> element) {
- JsonArray array = new JsonArray();
- TypeConverter<TextStyle> conv = TypeConverterRegistry.getTypeConverter("textstyle", TextStyle.class);
- for (TextStyle st:element) {
- array.add(conv.serialize(st));
- }
- return array;
- }
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java
deleted file mode 100644
index b1c3ed5c..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverter.java
+++ /dev/null
@@ -1,29 +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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import com.google.gson.JsonElement;
-
-public interface TypeConverter<T> {
- String getTypeString();
-
- T deserialize(JsonElement element);
-
- JsonElement serialize(T element);
-}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java
deleted file mode 100644
index abffd34a..00000000
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.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 <https://www.gnu.org/licenses/>.
- */
-
-package kr.syeyoung.dungeonsguide.config.types;
-
-import kr.syeyoung.dungeonsguide.roomedit.Parameter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class TypeConverterRegistry {
- private static final Map<String, TypeConverter> typeConverterMap = new HashMap<String, TypeConverter>();
-
- public static void register(TypeConverter typeConverter) {
- typeConverterMap.put(typeConverter.getTypeString(), typeConverter);
- }
-
- public static TypeConverter getTypeConverter(String type_string) {
- return typeConverterMap.get(type_string);
- }
- public static <T> TypeConverter<T> getTypeConverter(String type_string, Class<T> t) {
- return (TypeConverter<T>)typeConverterMap.get(type_string);
- }
-
- static {
- register(new TCBoolean());
- register(new TCInteger());
- register(new TCRectangle());
- register(new TCGUIRectangle());
- register(new TCString());
- register(new TCColor());
- register(new TCFloat());
- register(new TCAColor());
- register(new TCTextStyleList());
- register(new TCTextStyle());
- register(new TCStringList());
- register(new TCKeybind());
- }
-}