aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-01-25 17:07:07 +0900
committersyeyoung <cyoung06@naver.com>2023-01-25 17:14:42 +0900
commitc857d35a2d457fe60f4a7365c728b6f8808118ed (patch)
tree171b243abc74f1ec139c0015cfea4fc82def54ec /mod
parentac290df4d6bd38942214cbfc4f99f4955e92cfec (diff)
downloadSkyblock-Dungeons-Guide-c857d35a2d457fe60f4a7365c728b6f8808118ed.tar.gz
Skyblock-Dungeons-Guide-c857d35a2d457fe60f4a7365c728b6f8808118ed.tar.bz2
Skyblock-Dungeons-Guide-c857d35a2d457fe60f4a7365c728b6f8808118ed.zip
- option to specify
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java3
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java22
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java10
3 files changed, 32 insertions, 3 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index 9cd0af73..f583d143 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -190,7 +190,8 @@ public class DungeonsGuide implements DGInterface {
registerEventsForge(ChatTransmitter.INSTANCE);
registerEventsForge(new BlockCache());
- (new FeatureRegistry()).init();
+ FeatureRegistry.getFeatureList();
+
try {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java
index 953a683a..b670b72a 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java
@@ -38,6 +38,7 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureVi
import kr.syeyoung.dungeonsguide.mod.features.impl.secret.*;
import kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse;
import kr.syeyoung.dungeonsguide.mod.features.impl.solvers.*;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager;
import lombok.Getter;
import org.lwjgl.input.Keyboard;
@@ -134,6 +135,27 @@ public class FeatureRegistry {
addParameter("key", new FeatureParameter<Integer>("key", "Key", "Press to navigate to next best secret", Keyboard.KEY_NONE, "keybind"));
}});
+ public static final SimpleFeature GLOBAL_HUD_SCALE = register(new SimpleFeature("Misc", "Global HUD Scale", "Configure to use gui scale from Minecraft or specify custom one", "hud.globalscale", false) {
+ private boolean init = false;
+ {
+ addParameter("mc", new FeatureParameter<Boolean>("mc", "Minecraft", "Enable to use minecraft default hud scale", true, "boolean", a -> {
+ if (init)
+ OverlayManager.getEventHandler().guiResize(null);
+ }));
+ addParameter("scale", new FeatureParameter<Float>("scale", "Scale", "Custom HUD Scale",1.0f, "float", a -> {
+ if (init)
+ OverlayManager.getEventHandler().guiResize(null);
+
+ }));
+ init = true;
+ }
+
+ @Override
+ public boolean isDisyllable() {
+ return false;
+ }
+ });
+
public static final FeatureEpicCountdown EPIC_COUNTDOWN = register(new FeatureEpicCountdown());
public static final SimpleFeature RENDER_BREACONS = register(new SimpleFeature("Dungeon.Secrets.Preferences", "Render beacons", "Should the mod not render beacons on secret", "secret.beacons", false));
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
index a7f6cd19..a9fb429e 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.mod.overlay;
+import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.mod.guiv2.RootDom;
import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Scaler;
import kr.syeyoung.dungeonsguide.mod.guiv2.elements.popups.PopupMgr;
@@ -73,17 +74,22 @@ public class OverlayManager {
scaler = new Scaler();
scaler.child.setValue(popupMgr);
- scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor());
+ scaler.scale.setValue(getScale());
view = new RootDom(scaler);
guiResize(null);
view.setMounted(true);
}
+ private double getScale() {
+ boolean useMc = FeatureRegistry.GLOBAL_HUD_SCALE.<Boolean>getParameter("mc").getValue();
+ if (useMc) return (double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor();
+ else return FeatureRegistry.GLOBAL_HUD_SCALE.<Float>getParameter("scale").getValue();
+ }
@SubscribeEvent()
public void guiResize(GuiScreenEvent.InitGuiEvent.Post post){
try {
- scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor());
+ scaler.scale.setValue(getScale());
view.setRelativeBound(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
view.setAbsBounds(new Rect(0,0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));
view.setSize(new Size(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight));