aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config
diff options
context:
space:
mode:
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();
-