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); + } }