diff options
Diffstat (limited to 'mod/src/main/java/kr/syeyoung')
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)); |