aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-08-03 18:16:55 +0900
committersyeyoung <cyong06@naver.com>2021-08-03 18:16:55 +0900
commit5f8c2788c2a7a62bf8b522ecfa39c6801333b577 (patch)
treee88c7a2912c657f9a22ed930e309ea0ca25fe974 /src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
parent982e460c861579f49959c08e25505a27e9c6b3f0 (diff)
downloadSkyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.tar.gz
Skyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.tar.bz2
Skyblock-Dungeons-Guide-5f8c2788c2a7a62bf8b522ecfa39c6801333b577.zip
- Fix copyright on Penguin
- Fix Parameter edit not resizing correctly - Debug can now be enabled via config - Config resizes according to user's minecraft size
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java9
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java2
3 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
index 8b3e3eb4..5ab53b67 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/GuiConfigV2.java
@@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.config.guiconfig.nyu;
import kr.syeyoung.dungeonsguide.gui.MGui;
import lombok.Getter;
import net.minecraft.client.Minecraft;
+import net.minecraft.util.MathHelper;
import java.awt.*;
@@ -40,8 +41,14 @@ public class GuiConfigV2 extends MGui {
super.initGui();
int dw = Minecraft.getMinecraft().displayWidth;
int dh = Minecraft.getMinecraft().displayHeight;
- rootConfigPanel.setBounds(new Rectangle((dw-1500)/2, (dh-800)/2, 1500,800));
- rootConfigPanel.setScale(2.0);
+ 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
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
index cf57619f..7fbffbf8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MCategory.java
@@ -48,7 +48,8 @@ public class MCategory extends MPanel {
@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(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f));
+ if (getBounds().height >= 28)
+ Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f));
Gui.drawRect(0,17,getBounds().width, 18,RenderUtils.blendAlpha(0x141414, 0.12f));
@@ -70,7 +71,11 @@ public class MCategory extends MPanel {
@Override
public Dimension getPreferredSize() {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- int descriptionHeight = fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().getOrDefault(nestedCategory.categoryFull(), ""), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT;
+
+ int descriptionHeight =
+ FeatureRegistry.getCategoryDescription().containsKey(nestedCategory.categoryFull()) ?
+ fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().get(nestedCategory.categoryFull()), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT
+ : -11;
return new Dimension(100, descriptionHeight + 28);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java
index 341705ee..4bf958db 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/nyu/MParameterEdit.java
@@ -143,7 +143,7 @@ public class MParameterEdit extends MPanel {
@Override
public Dimension getPreferredSize() {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
- int descriptionHeight = fr.listFormattedStringToWidth(FeatureRegistry.getCategoryDescription().getOrDefault(featureParameter.getDescription(), ""), Math.max(100, getBounds().width - 10)).size() * fr.FONT_HEIGHT;
+ int descriptionHeight = fr.listFormattedStringToWidth(featureParameter.getDescription(), 2*bounds.width /3-10).size() * fr.FONT_HEIGHT;
return new Dimension(100, Math.max(Math.max(30, descriptionHeight + 23), valueEditHolder.getPreferredSize().height));
}