mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 20:23:53 -07:00
/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:
@@ -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
|
||||
);
|
Reference in New Issue
Block a user