/net/minecraft/world/entity/monster

Some blocks

LayeredCauldronBlock.java.patch has strange diff-- the comment seems to be a red herring.

net/minecraft/network/protocol/login/
This commit is contained in:
Owen1212055
2025-05-29 16:56:28 -04:00
parent d251511d35
commit 62c4dda5f4
10 changed files with 141 additions and 192 deletions

View File

@@ -0,0 +1,30 @@
--- a/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
+++ b/net/minecraft/network/protocol/login/ClientboundLoginDisconnectPacket.java
@@ -14,8 +_,25 @@
public record ClientboundLoginDisconnectPacket(Component reason) implements Packet<ClientLoginPacketListener> {
private static final RegistryOps<JsonElement> OPS = RegistryAccess.EMPTY.createSerializationContext(JsonOps.INSTANCE);
- public static final StreamCodec<ByteBuf, ClientboundLoginDisconnectPacket> STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.lenientJson(262144).apply(ByteBufCodecs.fromCodec(OPS, ComponentSerialization.CODEC)),
+ // Paper start - localized codec
+ // In the login phase, buffer.adventure$locale field is most likely null, but plugins may use internals to set it via the channel attribute
+ public static final StreamCodec<net.minecraft.network.FriendlyByteBuf, ClientboundLoginDisconnectPacket> STREAM_CODEC = StreamCodec.composite(
+ new net.minecraft.network.codec.StreamCodec<>() {
+
+ private static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, com.google.gson.JsonElement> LENIENT_JSON = net.minecraft.network.codec.ByteBufCodecs.lenientJson(net.minecraft.network.FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
+ @Override
+ public net.minecraft.network.chat.Component decode(final net.minecraft.network.FriendlyByteBuf buffer) {
+ java.util.Locale bufLocale = buffer.adventure$locale;
+ return LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).decode(buffer);
+ }
+
+ @Override
+ public void encode(final net.minecraft.network.FriendlyByteBuf buffer, final net.minecraft.network.chat.Component value) {
+ java.util.Locale bufLocale = buffer.adventure$locale;
+ LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).encode(buffer, value);
+ }
+ },
+ // Paper end - localized codec
ClientboundLoginDisconnectPacket::reason,
ClientboundLoginDisconnectPacket::new
);