From a874f9d15155250bec22efa14a5035b156b9c12c Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:34:56 -0700 Subject: [PATCH 1/2] prevent keybinds from overflowing left side of GUI --- .../universaltweaks/config/UTConfigTweaks.java | 5 +++++ .../universaltweaks/core/UTLoadingPlugin.java | 3 +++ .../gui/keybindlist/mixin/UTKeyEntryMixin.java | 17 +++++++++++++++++ ...mixins.tweaks.misc.gui.keybindlistentry.json | 7 +++++++ 4 files changed, 32 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/keybindlist/mixin/UTKeyEntryMixin.java create mode 100644 src/main/resources/mixins.tweaks.misc.gui.keybindlistentry.json diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index d098fc95..9400547c 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1242,6 +1242,11 @@ public static class MiscCategory @Config.Comment("Enhance the vanilla 'Open to LAN' GUI for listening port customization, removal of enforced authentication and more") public boolean utLANServerProperties = true; + @Config.RequiresMcRestart + @Config.Name("Prevent Keybinds from Overflowing Screen") + @Config.Comment("Always indent keybind entries from the screen edge, preventing them from overflowing off the left side when particularly long keybind names are present") + public boolean utPreventKeybindingEntryOverflow = true; + @Config.RequiresMcRestart @Config.Name("Compact Messages") @Config.Comment("Removes duplicate messages and instead put a number behind the message how often it was repeated") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index c69b4db0..e1e895c5 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -128,6 +128,7 @@ public List getMixinConfigs() configs.add("mixins.tweaks.misc.commands.seed.json"); configs.add("mixins.tweaks.misc.credits.json"); configs.add("mixins.tweaks.misc.difficulty.client.json"); + configs.add("mixins.tweaks.misc.gui.keybindlistentry.json"); configs.add("mixins.tweaks.misc.gui.lanserverproperties.json"); configs.add("mixins.tweaks.misc.gui.overlaymessage.json"); configs.add("mixins.tweaks.misc.gui.potionduration.json"); @@ -312,6 +313,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigTweaks.MISC.utCopyWorldSeedToggle; case "mixins.tweaks.misc.credits.json": return UTConfigTweaks.MISC.utSkipCreditsToggle; + case "mixins.tweaks.misc.gui.keybindlistentry.json": + return UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow; case "mixins.tweaks.misc.gui.lanserverproperties.json": return UTConfigTweaks.MISC.utLANServerProperties; case "mixins.tweaks.misc.gui.overlaymessage.json": diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/keybindlist/mixin/UTKeyEntryMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/keybindlist/mixin/UTKeyEntryMixin.java new file mode 100644 index 00000000..85358db1 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/keybindlist/mixin/UTKeyEntryMixin.java @@ -0,0 +1,17 @@ +package mod.acgaming.universaltweaks.tweaks.misc.gui.keybindlist.mixin; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiKeyBindingList; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = GuiKeyBindingList.KeyEntry.class) +public abstract class UTKeyEntryMixin +{ + @Redirect(method = "drawEntry", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawString(Ljava/lang/String;III)I")) + public int utIndentEntryText(FontRenderer f, String text, int x, int y, int color) + { + return f.drawString(text, Math.max(x, 5), y, color); + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.gui.keybindlistentry.json b/src/main/resources/mixins.tweaks.misc.gui.keybindlistentry.json new file mode 100644 index 00000000..b99bc6e9 --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.gui.keybindlistentry.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.gui.keybindlist.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTKeyEntryMixin"] +} \ No newline at end of file From c41b9b33b0973ec3132e9ecfd04edb1cf37ad24b Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:27:06 -0700 Subject: [PATCH 2/2] mark a mod as obsolete --- .../universaltweaks/util/compat/UTObsoleteModsHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index 5ff18c16..ce025c5d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -75,6 +75,7 @@ public static List obsoleteModsMessage() if (Loader.isModLoaded("ikwid") && UTConfigTweaks.MISC.TOAST_CONTROL.utToastControlTutorialToggle) messages.add("I Know What I'm Doing"); if (Loader.isModLoaded("insomniac") && UTConfigTweaks.ENTITIES.SLEEPING.utDisableSleepingToggle) messages.add("Insomniac"); if (Loader.isModLoaded("inventoryspam") && UTConfigTweaks.MISC.PICKUP_NOTIFICATION.utPickupNotificationToggle) messages.add("Inventory Spam"); + if (Loader.isModLoaded("keydescfix") && UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow) messages.add("Keybind Description Fix"); if (Loader.isModLoaded("lanserverproperties") && UTConfigTweaks.MISC.utLANServerProperties) messages.add("LAN Server Properties"); if (Loader.isModLoaded("leafdecay") && UTConfigTweaks.BLOCKS.utLeafDecayToggle) messages.add("Leaf Decay Accelerator"); if (Loader.isModLoaded("letmedespawn") && UTConfigTweaks.ENTITIES.utMobDespawnToggle) messages.add("Let Me Despawn");