diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch new file mode 100644 index 0000000000..c95bd4e06e --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -0,0 +1,44 @@ +--- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java ++++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +@@ -12,7 +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.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)); +@@ -24,12 +24,13 @@ + return (CustomPacketPayload) (friendlybytebuf_reader != null ? (CustomPacketPayload) friendlybytebuf_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 servercommonpacketlistener) { + servercommonpacketlistener.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 + } |