From 536fcdf62da0d6d5cb570a3306195befa0b5836c Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 5 May 2023 19:17:16 +0700 Subject: [PATCH] sexy --- .../chipmunk/chipmunkmod/mixin/ChatScreenMixin.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java index 9829104..d7525a4 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java @@ -1,15 +1,20 @@ package land.chipmunk.chipmunkmod.mixin; import land.chipmunk.chipmunkmod.modules.CustomChat; +import net.minecraft.client.gui.widget.TextFieldWidget; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.client.MinecraftClient; import land.chipmunk.chipmunkmod.command.CommandManager; @Mixin(net.minecraft.client.gui.screen.ChatScreen.class) public class ChatScreenMixin { + @Shadow protected TextFieldWidget chatField; + @Inject(at = @At("HEAD"), method = "sendMessage", cancellable = true) public void sendMessage(String chatText, boolean addToHistory, CallbackInfoReturnable cir) { if (chatText.startsWith(CommandManager.prefix)) { @@ -26,4 +31,9 @@ public class ChatScreenMixin { cir.setReturnValue(true); } } + + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setMaxLength(I)V"), method = "init") + public void init (CallbackInfo ci) { + chatField.setMaxLength(Integer.MAX_VALUE); + } }