aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-27 02:02:38 +0900
committersyeyoung <cyong06@naver.com>2021-02-27 02:02:38 +0900
commitb0524098c6e6ae399fff7b94f8423e2f0d1b9567 (patch)
tree865efe368a3c0b65f83b36c991ad4d6401aa0392 /src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig
parenta67de30acd54d4781dded0e86e5980bbb5402809 (diff)
downloadSkyblock-Dungeons-Guide-b0524098c6e6ae399fff7b94f8423e2f0d1b9567.tar.gz
Skyblock-Dungeons-Guide-b0524098c6e6ae399fff7b94f8423e2f0d1b9567.tar.bz2
Skyblock-Dungeons-Guide-b0524098c6e6ae399fff7b94f8423e2f0d1b9567.zip
bruh
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java38
1 files changed, 31 insertions, 7 deletions
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 6ce54077..c9a1922c 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java
@@ -1,8 +1,11 @@
package kr.syeyoung.dungeonsguide.config.guiconfig;
+import kr.syeyoung.dungeonsguide.config.types.GUIRectangle;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
import kr.syeyoung.dungeonsguide.gui.MPanel;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import java.awt.*;
@@ -17,7 +20,7 @@ public class PanelDelegate extends MPanel {
@Override
public Rectangle getBounds() {
- return guiFeature.getFeatureRect();
+ return guiFeature.getFeatureRect().getRectangle();
}
@Override
@@ -86,7 +89,7 @@ public class PanelDelegate extends MPanel {
minWidth = 8;
minHeight = 8;
}
- Rectangle rectangle = guiFeature.getFeatureRect().getBounds();
+ Rectangle rectangle = guiFeature.getFeatureRect().getRectangle().getBounds();
if (rectangle.width < minWidth || rectangle.height < minHeight) {
rectangle.width = minWidth;
rectangle.height= minHeight;
@@ -95,7 +98,14 @@ public class PanelDelegate extends MPanel {
if (rectangle.x < 0) rectangle.x = 0;
if (rectangle.y < 0) rectangle.y = 0;
- guiFeature.setFeatureRect(rectangle);
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GUIRectangle guiRectangle = new GUIRectangle(
+ rectangle.x / scaledResolution.getScaledWidth_double(),
+ rectangle.y / scaledResolution.getScaledHeight_double(),
+ rectangle.width / scaledResolution.getScaledWidth_double(),
+ rectangle.height / scaledResolution.getScaledHeight_double()
+ );
+ guiFeature.setFeatureRect(guiRectangle);
}
selectedPart = -2;
@@ -111,7 +121,7 @@ public class PanelDelegate extends MPanel {
if (selectedPart >= 0) {
boolean revChangeX = (selectedPart & 0x1) == 0;
boolean revChangeY = (selectedPart & 0x2) == 0;
- Rectangle rectangle = guiFeature.getFeatureRect().getBounds();
+ Rectangle rectangle = guiFeature.getFeatureRect().getRectangle().getBounds();
int prevWidth = rectangle.width;
int prevHeight= rectangle.height;
@@ -156,12 +166,26 @@ public class PanelDelegate extends MPanel {
lastX += revChangeX ? 3 : 3;
}
- guiFeature.setFeatureRect(rectangle);
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GUIRectangle guiRectangle = new GUIRectangle(
+ rectangle.x / scaledResolution.getScaledWidth_double(),
+ rectangle.y / scaledResolution.getScaledHeight_double(),
+ rectangle.width / scaledResolution.getScaledWidth_double(),
+ rectangle.height / scaledResolution.getScaledHeight_double()
+ );
+ guiFeature.setFeatureRect(guiRectangle);
throw new IllegalArgumentException("bruh, a hack to stop event progress");
} else if (selectedPart == -1){
- Rectangle rectangle = guiFeature.getFeatureRect().getBounds();
+ Rectangle rectangle = guiFeature.getFeatureRect().getRectangle().getBounds();
rectangle.translate(dx, dy);
- guiFeature.setFeatureRect(rectangle);
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GUIRectangle guiRectangle = new GUIRectangle(
+ rectangle.x / scaledResolution.getScaledWidth_double(),
+ rectangle.y / scaledResolution.getScaledHeight_double(),
+ rectangle.width / scaledResolution.getScaledWidth_double(),
+ rectangle.height / scaledResolution.getScaledHeight_double()
+ );
+ guiFeature.setFeatureRect(guiRectangle);
lastX = absMouseX;
lastY = absMouseY;
}