aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>2023-10-21 11:19:40 -0400
committerGitHub <noreply@github.com>2023-10-22 00:19:40 +0900
commit18a855417a3ce0244c159a6db20cf2a5bdef46f0 (patch)
tree98efbd86f24efec6097b2af02da952c81cb639c6
parente0995c5536c599f291f3d703cfcbf5a4ac6f55e6 (diff)
downloadSkyblock-Dungeons-Guide-18a855417a3ce0244c159a6db20cf2a5bdef46f0.tar.gz
Skyblock-Dungeons-Guide-18a855417a3ce0244c159a6db20cf2a5bdef46f0.tar.bz2
Skyblock-Dungeons-Guide-18a855417a3ce0244c159a6db20cf2a5bdef46f0.zip
Feature: GUI scale command (closes #396) (#429)
* add alias per #400 * add alias per #400 (attempt #2) * add another alias * revise arraylist initalization * intellij is saying this import is unused. removed it * add justifications for aliases * swap "dg" and "dungeonsguide" * Revert "swap "dg" and "dungeonsguide"" This reverts commit 2ddbaf8f58d5d7937389909d96d5797c76c16639. * swap "dg" and "dungeonsguide" (for real this time) * ui scale command * actually reset scale * remove unused imports * remove unused imports again Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> * update command desc Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> --------- Signed-off-by: Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com>
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
index 1ea1cee1..ff3e8038 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
@@ -110,7 +110,9 @@ public class CommandDungeonsGuide extends CommandBase {
return;
}
- switch (args[0].toLowerCase()) {
+ String subcommand = args[0].toLowerCase();
+
+ switch (subcommand) {
case "reparty":
repartyCommand();
break;
@@ -148,6 +150,12 @@ public class CommandDungeonsGuide extends CommandBase {
unloadCommand();
break;
+ case "setuiscale":
+ case "setscale":
+ case "uiscale":
+ case "scale":
+ setUIScale(args);
+ break;
case "aliases":
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide aliases§7::"));
@@ -159,6 +167,7 @@ public class CommandDungeonsGuide extends CommandBase {
default:
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui"));
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui"));
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg scale [scale] §7-§fSets the Global HUD scale (Also disables Minecraft default HUD scale for you as well if you haven't already.)"));
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg help §7-§fShows command help"));
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg reparty §7-§f Reparty."));
ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §e/dg asktojoin or /dg atj §7-§f Toggle ask to join §cRequires Discord Rich Presence enabled. (/dg -> Advanced)"));
@@ -171,6 +180,32 @@ public class CommandDungeonsGuide extends CommandBase {
}
}
+ private void setUIScale(String[] args) {
+ if (args.length != 2) {
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cUsage: /dg " + args[0] + " [scale]"));
+ return;
+ }
+ try {
+ Double.parseDouble(args[1]);
+ } catch ( NumberFormatException e ) {
+ if (args[1] instanceof String && (args[1].toLowerCase().equals("reset") || args[1].toLowerCase().equals("r"))) {
+ FeatureRegistry.GLOBAL_HUD_SCALE.<Double>getParameter("scale").setValue(1d);
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §eGlobal HUD scale successfully reset to 1."));
+ } else {
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cSorry, but " + args[1] + " is not a valid GUI scale. Try again."));
+ }
+ return;
+ }
+ Double theScale = Double.parseDouble(args[1]);
+ if (theScale < 0.01 || theScale > (Math.PI + Math.E)) {
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §cSorry, but while " + args[1] + " is a valid number, it is not a suitable GUI scale. Try again, §eor reset your Global HUD scale with §6/dg " + args[0] + " reset§e."));
+ return;
+ }
+ ChatTransmitter.addToQueue(new ChatComponentText("§eDungeons Guide §7:: §aSuccessfully set your Global HUD scale to " + args[1] + ". §eTo reset your Global HUD scale, run §6/dg " + args[0] + " reset§e."));
+ FeatureRegistry.GLOBAL_HUD_SCALE.<Boolean>getParameter("mc").setValue(false);
+ FeatureRegistry.GLOBAL_HUD_SCALE.<Double>getParameter("scale").setValue(theScale);
+ }
+
private GuiScreen target;
@SubscribeEvent