From 1807a69f77715165c11300f0d5ad79e1adb48126 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:13:04 -0700 Subject: [PATCH 1/7] configurable Chat Lines --- README.md | 1 + .../config/UTConfigTweaks.java | 10 ++++++++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../chatlines/mixin/UTGuiNewChatMixin.java | 19 +++++++++++++++++++ .../util/compat/UTObsoleteModsHandler.java | 1 + .../mixins.tweaks.misc.chatlines.json | 7 +++++++ 6 files changed, 39 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java create mode 100644 src/main/resources/mixins.tweaks.misc.chatlines.json diff --git a/README.md b/README.md index 2fc97930..fec1d82d 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ All changes are toggleable via config files. * **Breakable Bedrock:** Allows customizable mining of bedrock * **Burning Baby Zombies:** Lets baby zombies burn in daylight as in Minecraft 1.13+ * **Charged Creeper Spawning:** Sets the chance for creepers to spawn charged +* **Chat Lines:** Sets the maximum number of chat lines to display * **Check Animated Models:** Improves model load times by checking if an animated model exists before trying to load it * **Chicken Shedding:** Allows chickens to have a chance to shed feathers (similarly to laying eggs) * **Chunk Gen Limit:** Limits maximum chunk generation per tick for improved server performance diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 99f32fda..5babc9da 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1250,6 +1250,16 @@ public static class MiscCategory @Config.Comment("Always displays the actual potion duration instead of `**:**`") public boolean utPotionDurationToggle = true; + @Config.RequiresMcRestart + @Config.Name("Chat Lines") + @Config.Comment + ({ + "Sets the maximum number of chat lines to display", + "100 is the vanilla default", + "0 or less functionally disables the chat" + }) + public int utChatLines = 100; + @Config.RequiresMcRestart @Config.Name("Copy World Seed") @Config.Comment("Enables clicking of `/seed` world seed in chat to copy to clipboard") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index ae0eff28..b9a770d4 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -51,6 +51,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.buttons.anaglyph.json", () -> UTConfigTweaks.MISC.ut3DAnaglyphButtonToggle); put("mixins.tweaks.misc.buttons.realms.json", () -> UTConfigTweaks.MISC.utRealmsButtonToggle && !randomPatchesLoaded); put("mixins.tweaks.misc.buttons.snooper.client.json", () -> UTConfigTweaks.MISC.utSnooperToggle); + put("mixins.tweaks.misc.chatlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); put("mixins.tweaks.misc.commands.seed.json", () -> UTConfigTweaks.MISC.utCopyWorldSeedToggle); put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle); put("mixins.tweaks.misc.gui.keybindlistentry.json", () -> UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java new file mode 100644 index 00000000..cbb39e62 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java @@ -0,0 +1,19 @@ +package mod.acgaming.universaltweaks.tweaks.misc.chatlines.mixin; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import net.minecraft.client.gui.GuiNewChat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(value = GuiNewChat.class) +public class UTGuiNewChatMixin +{ + @ModifyConstant(method = "setChatLine", constant = @Constant(intValue = 100)) + public int utAdvancementToast(int original) + { + // Prevents negative config numbers generating an NPE + if (UTConfigTweaks.MISC.utChatLines < 0) return 0; + return UTConfigTweaks.MISC.utChatLines; + } +} \ No newline at end of file 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 7e5e6778..cbe50e4e 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -30,6 +30,7 @@ public class UTObsoleteModsHandler put("bedsaynosleep", () -> UTConfigTweaks.ENTITIES.SLEEPING.utDisableSleepingToggle); put("betterburning", () -> UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBArrowsToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBCookedToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBExtinguishToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBOverlayToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBSpreadingToggle); put("betterplacement", () -> UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementToggle); + put("biggerchathistory", () -> UTConfigTweaks.MISC.utChatLines != 100); put("biggerpacketsplz", () -> UTConfigBugfixes.MISC.utPacketSize > 0x200000); put("blockdispenser", () -> UTConfigTweaks.BLOCKS.BLOCK_DISPENSER.utBlockDispenserToggle); put("blockfire", () -> UTConfigBugfixes.ENTITIES.utBlockFireToggle); diff --git a/src/main/resources/mixins.tweaks.misc.chatlines.json b/src/main/resources/mixins.tweaks.misc.chatlines.json new file mode 100644 index 00000000..86670dae --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.chatlines.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.chatlines.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTGuiNewChatMixin"] +} \ No newline at end of file From cffd1f4b53d0be92e25eda482a972a402f3d5ae8 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:22:21 -0700 Subject: [PATCH 2/7] move location --- .../java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java | 2 +- .../maximumlines}/mixin/UTGuiNewChatMixin.java | 2 +- ...chatlines.json => mixins.tweaks.misc.chat.maximumlines.json} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/mod/acgaming/universaltweaks/tweaks/misc/{chatlines => chat/maximumlines}/mixin/UTGuiNewChatMixin.java (89%) rename src/main/resources/{mixins.tweaks.misc.chatlines.json => mixins.tweaks.misc.chat.maximumlines.json} (62%) diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index b9a770d4..70c13a53 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -51,7 +51,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.buttons.anaglyph.json", () -> UTConfigTweaks.MISC.ut3DAnaglyphButtonToggle); put("mixins.tweaks.misc.buttons.realms.json", () -> UTConfigTweaks.MISC.utRealmsButtonToggle && !randomPatchesLoaded); put("mixins.tweaks.misc.buttons.snooper.client.json", () -> UTConfigTweaks.MISC.utSnooperToggle); - put("mixins.tweaks.misc.chatlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); + put("mixins.tweaks.misc.chat.maximumlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); put("mixins.tweaks.misc.commands.seed.json", () -> UTConfigTweaks.MISC.utCopyWorldSeedToggle); put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle); put("mixins.tweaks.misc.gui.keybindlistentry.json", () -> UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java similarity index 89% rename from src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java rename to src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java index cbb39e62..5a2fb048 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chatlines/mixin/UTGuiNewChatMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java @@ -1,4 +1,4 @@ -package mod.acgaming.universaltweaks.tweaks.misc.chatlines.mixin; +package mod.acgaming.universaltweaks.tweaks.misc.chat.maximumlines.mixin; import mod.acgaming.universaltweaks.config.UTConfigTweaks; import net.minecraft.client.gui.GuiNewChat; diff --git a/src/main/resources/mixins.tweaks.misc.chatlines.json b/src/main/resources/mixins.tweaks.misc.chat.maximumlines.json similarity index 62% rename from src/main/resources/mixins.tweaks.misc.chatlines.json rename to src/main/resources/mixins.tweaks.misc.chat.maximumlines.json index 86670dae..3afcfadc 100644 --- a/src/main/resources/mixins.tweaks.misc.chatlines.json +++ b/src/main/resources/mixins.tweaks.misc.chat.maximumlines.json @@ -1,5 +1,5 @@ { - "package": "mod.acgaming.universaltweaks.tweaks.misc.chatlines.mixin", + "package": "mod.acgaming.universaltweaks.tweaks.misc.chat.maximumlines.mixin", "refmap": "universaltweaks.refmap.json", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", From 5b4b6f5b819541f426f1f973ad4db9319ca4a37e Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:22:34 -0700 Subject: [PATCH 3/7] make compactmessage mixin only load when enabled --- .../mod/acgaming/universaltweaks/core/UTLoadingPlugin.java | 1 + .../resources/mixins.tweaks.misc.chat.compactmessage.json | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 70c13a53..e30f0688 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -51,6 +51,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.buttons.anaglyph.json", () -> UTConfigTweaks.MISC.ut3DAnaglyphButtonToggle); put("mixins.tweaks.misc.buttons.realms.json", () -> UTConfigTweaks.MISC.utRealmsButtonToggle && !randomPatchesLoaded); put("mixins.tweaks.misc.buttons.snooper.client.json", () -> UTConfigTweaks.MISC.utSnooperToggle); + put("mixins.tweaks.misc.chat.compactmessage.json", () -> UTConfigTweaks.MISC.utCompactMessagesToggle); put("mixins.tweaks.misc.chat.maximumlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); put("mixins.tweaks.misc.commands.seed.json", () -> UTConfigTweaks.MISC.utCopyWorldSeedToggle); put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle); diff --git a/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json b/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json index cfb7af94..27acc556 100644 --- a/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json +++ b/src/main/resources/mixins.tweaks.misc.chat.compactmessage.json @@ -3,7 +3,5 @@ "refmap": "universaltweaks.refmap.json", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", - "client": [ - "UTCompactMessageMixin" - ] + "client": ["UTCompactMessageMixin"] } \ No newline at end of file From 562ce2ce3aae98ad35fdae76f32a0453c91b2d01 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:38:14 -0700 Subject: [PATCH 4/7] Keep Sent Messages --- README.md | 1 + .../config/UTConfigTweaks.java | 5 +++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../mixin/UTGuiNewChatMixin.java | 19 +++++++++++++++++++ ...ins.tweaks.misc.chat.keepsentmessages.json | 7 +++++++ 5 files changed, 33 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java create mode 100644 src/main/resources/mixins.tweaks.misc.chat.keepsentmessages.json diff --git a/README.md b/README.md index fec1d82d..a36a05db 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ All changes are toggleable via config files. * **Incurable Potions:** Excludes potion effects from being curable with curative items like buckets of milk * **Infinite Music:** Lets background music play continuously without delays * **Item Entities:** Enables the modification of item entity properties +* **Keep Sent Messages:** Don't clear sent message history on leaving the world * **LAN Server Properties:** Enhance the vanilla 'Open to LAN' GUI for listening port customization, removal of enforced authentication and more * **Lenient Paths:** Allows the creation of grass paths everywhere (beneath fence gates, trapdoors, ...) * **Lightning** diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 5babc9da..11ed5628 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1260,6 +1260,11 @@ public static class MiscCategory }) public int utChatLines = 100; + @Config.RequiresMcRestart + @Config.Name("Keep Sent Messages") + @Config.Comment("Don't clear sent message history on leaving the world") + public boolean utKeepSentMessageHistory = false; + @Config.RequiresMcRestart @Config.Name("Copy World Seed") @Config.Comment("Enables clicking of `/seed` world seed in chat to copy to clipboard") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index e30f0688..1afe9127 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -53,6 +53,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.buttons.snooper.client.json", () -> UTConfigTweaks.MISC.utSnooperToggle); put("mixins.tweaks.misc.chat.compactmessage.json", () -> UTConfigTweaks.MISC.utCompactMessagesToggle); put("mixins.tweaks.misc.chat.maximumlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); + put("mixins.tweaks.misc.chat.keepsentmessages.json", () -> UTConfigTweaks.MISC.utKeepSentMessageHistory); put("mixins.tweaks.misc.commands.seed.json", () -> UTConfigTweaks.MISC.utCopyWorldSeedToggle); put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle); put("mixins.tweaks.misc.gui.keybindlistentry.json", () -> UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java new file mode 100644 index 00000000..44db0433 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java @@ -0,0 +1,19 @@ +package mod.acgaming.universaltweaks.tweaks.misc.chat.keepsentmessages.mixin; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import net.minecraft.client.gui.GuiNewChat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = GuiNewChat.class) +public class UTGuiNewChatMixin +{ + @Inject(method = "clearChatMessages", at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V", ordinal = 2), cancellable = true) + public void utKeepSentMessageHistory(boolean clearHistory, CallbackInfo ci) + { + if (!UTConfigTweaks.MISC.utKeepSentMessageHistory) return; + ci.cancel(); + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.chat.keepsentmessages.json b/src/main/resources/mixins.tweaks.misc.chat.keepsentmessages.json new file mode 100644 index 00000000..1f3658b3 --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.chat.keepsentmessages.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.chat.keepsentmessages.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTGuiNewChatMixin"] +} \ No newline at end of file From 7a55f13535a2f27f3260ba15748e1bdbc4ecf7fa Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:43:51 -0700 Subject: [PATCH 5/7] move chat options to a category --- .../config/UTConfigTweaks.java | 48 +++++++++++-------- .../universaltweaks/core/UTLoadingPlugin.java | 6 +-- .../mixin/UTGuiNewChatMixin.java | 2 +- .../maximumlines/mixin/UTGuiNewChatMixin.java | 4 +- .../chat/mixin/UTCompactMessageMixin.java | 2 +- .../util/compat/UTObsoleteModsHandler.java | 2 +- .../assets/universaltweaks/lang/en_us.lang | 1 + 7 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 11ed5628..2b2a9c57 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1218,6 +1218,10 @@ public static class MiscCategory @Config.Name("Armor Curve") public final ArmorCurveCategory ARMOR_CURVE = new ArmorCurveCategory(); + @Config.LangKey("cfg.universaltweaks.tweaks.misc.chat") + @Config.Name("Chat") + public final ChatCategory CHAT = new ChatCategory(); + @Config.LangKey("cfg.universaltweaks.tweaks.misc.incurablepotions") @Config.Name("Incurable Potions") public final IncurablePotionsCategory INCURABLE_POTIONS = new IncurablePotionsCategory(); @@ -1250,21 +1254,6 @@ public static class MiscCategory @Config.Comment("Always displays the actual potion duration instead of `**:**`") public boolean utPotionDurationToggle = true; - @Config.RequiresMcRestart - @Config.Name("Chat Lines") - @Config.Comment - ({ - "Sets the maximum number of chat lines to display", - "100 is the vanilla default", - "0 or less functionally disables the chat" - }) - public int utChatLines = 100; - - @Config.RequiresMcRestart - @Config.Name("Keep Sent Messages") - @Config.Comment("Don't clear sent message history on leaving the world") - public boolean utKeepSentMessageHistory = false; - @Config.RequiresMcRestart @Config.Name("Copy World Seed") @Config.Comment("Enables clicking of `/seed` world seed in chat to copy to clipboard") @@ -1308,11 +1297,6 @@ public static class MiscCategory @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") - public boolean utCompactMessagesToggle = false; - @Config.RequiresMcRestart @Config.Name("Linear XP Amount") @Config.Comment @@ -1472,6 +1456,30 @@ public static class ArmorCurveCategory public boolean utArmorCurveLogging = false; } + public static class ChatCategory + { + @Config.RequiresMcRestart + @Config.Name("[1] Chat Lines") + @Config.Comment + ({ + "Sets the maximum number of chat lines to display", + "100 is the vanilla default", + "0 or less functionally disables the chat" + }) + public int utChatLines = 100; + + @Config.RequiresMcRestart + @Config.Name("[2] Keep Sent Messages") + @Config.Comment("Don't clear sent message history on leaving the world") + public boolean utKeepSentMessageHistory = false; + + @Config.RequiresMcRestart + @Config.Name("[3] Compact Messages") + @Config.Comment("Removes duplicate messages and instead put a number behind the message how often it was repeated") + public boolean utCompactMessagesToggle = false; + } + + public static class IncurablePotionsCategory { @Config.RequiresMcRestart diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 1afe9127..383a329b 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -51,9 +51,9 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.buttons.anaglyph.json", () -> UTConfigTweaks.MISC.ut3DAnaglyphButtonToggle); put("mixins.tweaks.misc.buttons.realms.json", () -> UTConfigTweaks.MISC.utRealmsButtonToggle && !randomPatchesLoaded); put("mixins.tweaks.misc.buttons.snooper.client.json", () -> UTConfigTweaks.MISC.utSnooperToggle); - put("mixins.tweaks.misc.chat.compactmessage.json", () -> UTConfigTweaks.MISC.utCompactMessagesToggle); - put("mixins.tweaks.misc.chat.maximumlines.json", () -> UTConfigTweaks.MISC.utChatLines != 100); - put("mixins.tweaks.misc.chat.keepsentmessages.json", () -> UTConfigTweaks.MISC.utKeepSentMessageHistory); + put("mixins.tweaks.misc.chat.compactmessage.json", () -> UTConfigTweaks.MISC.CHAT.utCompactMessagesToggle); + put("mixins.tweaks.misc.chat.maximumlines.json", () -> UTConfigTweaks.MISC.CHAT.utChatLines != 100); + put("mixins.tweaks.misc.chat.keepsentmessages.json", () -> UTConfigTweaks.MISC.CHAT.utKeepSentMessageHistory); put("mixins.tweaks.misc.commands.seed.json", () -> UTConfigTweaks.MISC.utCopyWorldSeedToggle); put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle); put("mixins.tweaks.misc.gui.keybindlistentry.json", () -> UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java index 44db0433..a8394705 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java @@ -13,7 +13,7 @@ public class UTGuiNewChatMixin @Inject(method = "clearChatMessages", at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V", ordinal = 2), cancellable = true) public void utKeepSentMessageHistory(boolean clearHistory, CallbackInfo ci) { - if (!UTConfigTweaks.MISC.utKeepSentMessageHistory) return; + if (!UTConfigTweaks.MISC.CHAT.utKeepSentMessageHistory) return; ci.cancel(); } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java index 5a2fb048..84cf4e5e 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java @@ -13,7 +13,7 @@ public class UTGuiNewChatMixin public int utAdvancementToast(int original) { // Prevents negative config numbers generating an NPE - if (UTConfigTweaks.MISC.utChatLines < 0) return 0; - return UTConfigTweaks.MISC.utChatLines; + if (UTConfigTweaks.MISC.CHAT.utChatLines < 0) return 0; + return UTConfigTweaks.MISC.CHAT.utChatLines; } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java index c5572116..91d88d4d 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/mixin/UTCompactMessageMixin.java @@ -50,7 +50,7 @@ public abstract class UTCompactMessageMixin @Inject(method = "setChatLine", at = @At("HEAD")) public void utCompactMessage(ITextComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) { - if (!UTConfigTweaks.MISC.utCompactMessagesToggle) return; + if (!UTConfigTweaks.MISC.CHAT.utCompactMessagesToggle) return; int count = 1; int chatSize = MathHelper.floor(this.getChatWidth() / this.getChatScale()); List splittedText = GuiUtilRenderComponents.splitText(chatComponent, chatSize, this.mc.fontRenderer, false, false); 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 cbe50e4e..c3664dd4 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -30,7 +30,7 @@ public class UTObsoleteModsHandler put("bedsaynosleep", () -> UTConfigTweaks.ENTITIES.SLEEPING.utDisableSleepingToggle); put("betterburning", () -> UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBArrowsToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBCookedToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBExtinguishToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBOverlayToggle || UTConfigTweaks.ENTITIES.BETTER_BURNING.utBBSpreadingToggle); put("betterplacement", () -> UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementToggle); - put("biggerchathistory", () -> UTConfigTweaks.MISC.utChatLines != 100); + put("biggerchathistory", () -> UTConfigTweaks.MISC.CHAT.utChatLines != 100); put("biggerpacketsplz", () -> UTConfigBugfixes.MISC.utPacketSize > 0x200000); put("blockdispenser", () -> UTConfigTweaks.BLOCKS.BLOCK_DISPENSER.utBlockDispenserToggle); put("blockfire", () -> UTConfigBugfixes.ENTITIES.utBlockFireToggle); diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 8e88c3a5..dd81523b 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -127,6 +127,7 @@ cfg.universaltweaks.tweaks.items.itementities=Item Entities cfg.universaltweaks.tweaks.items.mending=Mending cfg.universaltweaks.tweaks.items.parry=Shield Parry cfg.universaltweaks.tweaks.misc.armorcurve=Armor Curve +cfg.universaltweaks.tweaks.misc.chat=Chat cfg.universaltweaks.tweaks.misc.incurablepotions=Incurable Potions cfg.universaltweaks.tweaks.misc.lightning=Lightning cfg.universaltweaks.tweaks.misc.loadsounds=Load Sounds From 5b5f6b89901c9ceb19417918e65607969b277a9a Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:45:21 -0700 Subject: [PATCH 6/7] consolidate chat changes in readme --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a36a05db..8f76ab9a 100644 --- a/README.md +++ b/README.md @@ -109,12 +109,14 @@ All changes are toggleable via config files. * **Breakable Bedrock:** Allows customizable mining of bedrock * **Burning Baby Zombies:** Lets baby zombies burn in daylight as in Minecraft 1.13+ * **Charged Creeper Spawning:** Sets the chance for creepers to spawn charged -* **Chat Lines:** Sets the maximum number of chat lines to display +* **Chat:** + * **Chat Lines:** Sets the maximum number of chat lines to display + * **Compact Messages:** Removes duplicate messages and instead put a number behind the message how often it was repeated + * **Keep Sent Messages:** Don't clear sent message history on leaving the world * **Check Animated Models:** Improves model load times by checking if an animated model exists before trying to load it * **Chicken Shedding:** Allows chickens to have a chance to shed feathers (similarly to laying eggs) * **Chunk Gen Limit:** Limits maximum chunk generation per tick for improved server performance * **Cobweb Slowness:** Modifies the applied slowness factor when entities are moving in cobwebs -* **Compact Messages:** Removes duplicate messages and instead put a number behind the message how often it was repeated * **Copy World Seed:** Enables clicking of `/seed` world seed in chat to copy to clipboard * **Crafting Cache:** Adds an IRecipe cache to improve recipe performance in large modpacks * **Creeper Confetti:** Replaces deadly creeper explosions with delightful confetti (with a configurable chance) @@ -159,7 +161,6 @@ All changes are toggleable via config files. * **Incurable Potions:** Excludes potion effects from being curable with curative items like buckets of milk * **Infinite Music:** Lets background music play continuously without delays * **Item Entities:** Enables the modification of item entity properties -* **Keep Sent Messages:** Don't clear sent message history on leaving the world * **LAN Server Properties:** Enhance the vanilla 'Open to LAN' GUI for listening port customization, removal of enforced authentication and more * **Lenient Paths:** Allows the creation of grass paths everywhere (beneath fence gates, trapdoors, ...) * **Lightning** From f8da661dd2102bff726588985f21bd715886bfa9 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:52:28 -0700 Subject: [PATCH 7/7] add Courtesy of WaitingIdly --- .../misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java | 1 + .../tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java index a8394705..1cfda0c8 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/keepsentmessages/mixin/UTGuiNewChatMixin.java @@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +// Courtesy of WaitingIdly @Mixin(value = GuiNewChat.class) public class UTGuiNewChatMixin { diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java index 84cf4e5e..808c62fe 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/chat/maximumlines/mixin/UTGuiNewChatMixin.java @@ -6,6 +6,7 @@ import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; +// Courtesy of WaitingIdly @Mixin(value = GuiNewChat.class) public class UTGuiNewChatMixin {