aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-26 01:26:44 +0900
committersyeyoung <cyong06@naver.com>2021-02-26 01:26:44 +0900
commit3fbf9d1a6810485279ec3eed0378614a59a2315c (patch)
tree1f123b070982a4df4d2f0ec90cbde3ac7b741de1
parent1a1e216a3e58f13a6ecec14c726283943497d119 (diff)
downloadSkyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.tar.gz
Skyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.tar.bz2
Skyblock-Dungeons-Guide-3fbf9d1a6810485279ec3eed0378614a59a2315c.zip
ok loc config
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java6
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java4
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java8
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java21
5 files changed, 35 insertions, 6 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java
index 0da479db..27b71e06 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java
@@ -38,6 +38,12 @@ public class GuiConfig extends GuiScreen {
tabbedPane.setPageGenerator(ConfigPanelCreator.INSTANCE);
+ tabbedPane.addBookmarkRunnable("GUI Relocate", new Runnable() {
+ @Override
+ public void run() {
+ Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(GuiConfig.this, null));
+ }
+ });
for (final Map.Entry<String, List<AbstractFeature>> cate: FeatureRegistry.getFeaturesByCategory().entrySet())
if (!cate.getKey().equals("hidden")) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
index cbb60556..646cd0e5 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java
@@ -20,11 +20,11 @@ public class GuiGuiLocationConfig extends GuiScreen {
private MPanel mainPanel = new MPanel();
private GuiScreen before;
- public GuiGuiLocationConfig(final GuiScreen before) {
+ public GuiGuiLocationConfig(final GuiScreen before, AbstractFeature featureWhitelist) {
this.before = before;
for (AbstractFeature feature : FeatureRegistry.getFeatureList()) {
if (feature instanceof GuiFeature && feature.isEnabled()) {
- mainPanel.add(new PanelDelegate((GuiFeature) feature));
+ mainPanel.add(new PanelDelegate((GuiFeature) feature, featureWhitelist == null || feature == featureWhitelist));
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
index c0d8d74b..d10730b7 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java
@@ -68,7 +68,7 @@ public class MFeature extends MPanel {
button.setOnActionPerformed(new Runnable() {
@Override
public void run() {
- Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(config));
+ Minecraft.getMinecraft().displayGuiScreen(new GuiGuiLocationConfig(config, abstractFeature));
}
});
addons.add(button);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
index 77ad4cc8..6ce54077 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
@@ -9,8 +9,10 @@ import java.awt.*;
public class PanelDelegate extends MPanel {
private GuiFeature guiFeature;
- public PanelDelegate(GuiFeature guiFeature) {
+ private boolean draggable = false;
+ public PanelDelegate(GuiFeature guiFeature, boolean draggable) {
this.guiFeature = guiFeature;
+ this.draggable = draggable;
}
@Override
@@ -24,6 +26,7 @@ public class PanelDelegate extends MPanel {
guiFeature.drawDemo(partialTicks);
GlStateManager.popMatrix();
+ if (!draggable) return;
Gui.drawRect(0,0, 3, 3, 0xFFBBBBBB);
Gui.drawRect(0, getBounds().height - 3, 3, getBounds().height, 0xFFBBBBBB);
Gui.drawRect(getBounds().width - 3,0, getBounds().width, 3, 0xFFBBBBBB);
@@ -51,6 +54,7 @@ public class PanelDelegate extends MPanel {
@Override
public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
+ if (!draggable) return;
if (!lastAbsClip.contains(absMouseX, absMouseY)) return;
if (relMouseX < 3 && relMouseY < 3) {
selectedPart = 0;
@@ -71,6 +75,7 @@ public class PanelDelegate extends MPanel {
@Override
public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) {
+ if (!draggable) return;
if (selectedPart >= -1) {
int minWidth;
int minHeight;
@@ -100,6 +105,7 @@ public class PanelDelegate extends MPanel {
@Override
public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) {
+ if (!draggable) return;
int dx = absMouseX - lastX;
int dy = absMouseY - lastY;
if (selectedPart >= 0) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
index 9621c3af..87160cb6 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java
@@ -76,9 +76,25 @@ public class MNavigatingPane extends MPanel {
totalX += button1.getBounds().width;
button.setBounds(new Rectangle(totalX, 0, Math.max(25, fr.getStringWidth(name) + 6), 15));
bookMarks.add(button);
- if (bookMarks.size() == 1)
+ if (currentPage.isEmpty())
currentPage = addr;
}
+ public void addBookmarkRunnable(String name, final Runnable toRun) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ MTabButton button = new MTabButton(this, name, null) {
+ @Override
+ public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) {
+ if (lastAbsClip.contains(absMouseX, absMouseY)) {
+ toRun.run();
+ }
+ }
+ };
+ int totalX = 0;
+ for (MTabButton button1:bookMarks)
+ totalX += button1.getBounds().width;
+ button.setBounds(new Rectangle(totalX, 0, Math.max(25, fr.getStringWidth(name) + 6), 15));
+ bookMarks.add(button);
+ }
@Override
public List<MPanel> getChildComponents() {
@@ -86,7 +102,8 @@ public class MNavigatingPane extends MPanel {
if (!pages.containsKey(currentPage)) {
MPanel panel = pageGenerator.apply(currentPage);
MPanel panel2 = new MPanel() ;
- panel2.add(panel);
+ if (panel != null)
+ panel2.add(panel);
panel2.setBackgroundColor(background2);
pages.put(currentPage, panel2);
panel2.setBounds(new Rectangle(1,30,getBounds().width-2, getBounds().height-31));