mojira.dev
MC-311370

Gui.openChatAndAddText(ChatMethod, String) does not use ChatMethod parameter.

Problem:

Gui.openChatAndAddText(ChatMethod, String) is a helper method to open the chat screen and prefill the chat box with a message or command.

Calling Gui.openChatAndAddText(ChatMethod.MESSAGE, "Hello!") should open chat screen, and set the chat box contents to Hello!
But instead the chat box will contain /Hello!

Cause:

Gui.openChatAndAddText(ChatMethod, String) does not use it’s first parameter. It instead always passes a hardcoded value of ChatMethod.COMMAND to the screen opening code it calls, which means it will always prefix a / in the chat box, as shown in the link below.

https://mcsrc.dev/2/26.3-snapshot-9/net/minecraft/client/gui/Gui#L368-373

This looks to have been caused by a refactor where this method was added in 26.2 by moving code from ClientPacketListener

https://mcsrc.dev/2/26.1/net/minecraft/client/multiplayer/ClientPacketListener#L2765-2768

https://mcsrc.dev/2/26.2/net/minecraft/client/multiplayer/ClientPacketListener#L2769

It’s a very minor bug, but still not what you’d expect the method to do given it’s name and parameters.

Comments 1

Thank you for your report!
After consideration, the issue is being closed as Invalid.

This report does not describe a bug.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

tehbeard

(Unassigned)

Plausible

26.3 Snapshot 9

Retrieved