- Jigsaw blocks crash the game MC-251316
The big chat refactor continues; this time, they introduced "signed command arguments". This is used by MessageArgumentType and TextArgumentType. The client parses the commands and signs each argument. (see ArgumentSignatures) This also means the packets for commands are now separate from the chat message packet. (see CommandExecutionC2SPacket) Note that you can still use ClientPlayerEntity#sendChatMessage(String) with /-prefixed string to execute commands.
New classes:
ChatMessageSignatureis the signature for chat messages, containing the UUID, timestamp, andNetworkEncryptionUtils.SignatureData. Thenonestatic method returns the bogus signature - use this instead ofNetworkEncryptionUtils.SignatureData#NONE.updateSignaturemethod signs the message.SignedChatMessagecontains the chat message text and the signature. (This is used inPlayerManager#broadcast, etc.)ChatSignersigns the chat message. (the actual logic is inChatMessageSignature)CommandArgumentSignersigns the commands.
To allow custom message texts without breaking signatures, Mojang has introduced custom message types that server sends to clients. They are DRM-managed and defined in data/(namespace)/chat_type in the data packs. The message type contains "chat", "overlay", and "narration" fields, and are interpreted client-side.
The Display for the "chat" and "overlay" and Narration for the "narration" contain the "decoration" field, which specifies the decorations applied to the message. Decoration consists of the translation key, parameters of the translation (can be chosen from sender name, message content, and the team name only for /teammsg), and the style.
Message type can also control the "priority" of the narration. Currently there are only two types - chat and system, where system message narrations interrupt chat message narrations. (Note that this is also used to check if it should narrate in the first place when Narrator option is set to "narrate chat/narrate system".)
GameEventgot a new inner class,Info, that contains information about the event (like the emitted event and the emitter).- Banner patterns are no longer enums and instead use registry, making custom patterns way easier. The patterns that appear on Loom (the block, not build script) can be controlled by tags.
- Similarly, goat horn instruments are registry-controlled now.
RegistryKeyArgumentTypecontains new static methods for use with the new/placecommand.PacketByteBuf: new methodsreadNullableandwriteNullable. Also,BiFunctionpassed to writers are replaced withPacketByteBuf.PacketWriterandFunctionpassed to readers are replaced withPacketByteBuf.PacketReader, but this only impacts those who extend the interface (like in Java 7) instead of using functional interfaces.asChatSendernow exists inEntityrather thanPlayerEntity. Again, recompile should be enough.ChatMessageSenderrecord now contains theteamNamefield. To set the team name usewithTeamName.- Server resource pack handling has changed, but I haven't reviewed it yet. One thing to note is that
resource-pack-hashserver property is obsoleted and they should switch toresource-pack-sha1. Not providing the SHA1 hash will also lead to a console warning. ServerCommandSource:isExecutedByPlayer,getChatMessageSender,getSigner(returns the argument signer), andwithSigneradded.Stylenow has a codec and theofmethod that takesOptionalinstead of nullable constructor.TextColorandFormattingalso received codecs.Identifier#ofallows constructing an identifier from the namespace and the path, but unlike the constructor it returnsnullwhen the arguments are invalid, instead of throwing.JsonHelpergot new methods that stringify the JSON object with sorted keys.StringHelper#truncateChattruncates the passed message to at most 256 characters with no ellipsis. This is used by chat.Util#lastIndexGetteris a reinvented wheel that returnsvalue -> Math.max(0, values.lastIndexOf(value)).Uncaught SleepRequiredError: apple502j needs some sleep at ChangelogWriter.java @ 247