diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch new file mode 100644 index 0000000000..ecaab61eb6 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java ++++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +@@ -11,11 +12,7 @@ + + public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet<ServerCommonPacketListener> { + private static final int MAX_PAYLOAD_SIZE = 32767; +- private static final Map<ResourceLocation, FriendlyByteBuf.Reader<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.<ResourceLocation, FriendlyByteBuf.Reader<? extends CustomPacketPayload>>builder( +- +- ) +- .put(BrandPayload.ID, BrandPayload::new) +- .build(); ++ private static final Map<ResourceLocation, FriendlyByteBuf.a<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.<ResourceLocation, FriendlyByteBuf.a<? extends CustomPacketPayload>>builder().build(); // CraftBukkit - no special handling + + public ServerboundCustomPayloadPacket(FriendlyByteBuf friendlyByteBuf) { + this(readPayload(friendlyByteBuf.readResourceLocation(), friendlyByteBuf)); +@@ -26,11 +24,13 @@ + return (CustomPacketPayload)(reader != null ? reader.apply(friendlyByteBuf) : readUnknownPayload(resourceLocation, friendlyByteBuf)); + } + +- private static DiscardedPayload readUnknownPayload(ResourceLocation resourceLocation, FriendlyByteBuf friendlyByteBuf) { +- int i = friendlyByteBuf.readableBytes(); ++ private static UnknownPayload readUnknownPayload(ResourceLocation minecraftkey, FriendlyByteBuf packetdataserializer) { // CraftBukkit ++ int i = packetdataserializer.readableBytes(); ++ + if (i >= 0 && i <= 32767) { +- friendlyByteBuf.skipBytes(i); +- return new DiscardedPayload(resourceLocation); ++ // CraftBukkit start ++ return new UnknownPayload(minecraftkey, packetdataserializer.readBytes(i)); ++ // CraftBukkit end + } else { + throw new IllegalArgumentException("Payload may not be larger than 32767 bytes"); + } +@@ -46,4 +45,14 @@ + public void handle(ServerCommonPacketListener handler) { + handler.handleCustomPayload(this); + } ++ ++ // CraftBukkit start ++ public record UnknownPayload(ResourceLocation id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload { ++ ++ @Override ++ public void write(FriendlyByteBuf packetdataserializer) { ++ packetdataserializer.writeBytes(data); ++ } ++ } ++ // CraftBukkit end + } |