diff --git a/paper-server/patches/sources/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/paper-server/patches/sources/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch new file mode 100644 index 0000000000..b7477f930e --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java ++++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java +@@ -14,9 +_,7 @@ + private static final int MAX_PAYLOAD_SIZE = 32767; + public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec( + id -> DiscardedPayload.codec(id, 32767), +- Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)), list -> {}) +- ) +- .map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); ++ java.util.Collections.emptyList()).map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); // CraftBukkit - treat all packets the same + + @Override + public PacketType type() { diff --git a/paper-server/patches/unapplied/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch b/paper-server/patches/sources/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch similarity index 50% rename from paper-server/patches/unapplied/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch rename to paper-server/patches/sources/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch index 785d4efd47..034c2906c4 100644 --- a/paper-server/patches/unapplied/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch +++ b/paper-server/patches/sources/net/minecraft/network/protocol/common/custom/DiscardedPayload.java.patch @@ -1,24 +1,21 @@ --- a/net/minecraft/network/protocol/common/custom/DiscardedPayload.java +++ b/net/minecraft/network/protocol/common/custom/DiscardedPayload.java -@@ -4,16 +4,18 @@ +@@ -4,13 +_,15 @@ import net.minecraft.network.codec.StreamCodec; import net.minecraft.resources.ResourceLocation; -public record DiscardedPayload(ResourceLocation id) implements CustomPacketPayload { +public record DiscardedPayload(ResourceLocation id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload { // CraftBukkit - store data - - public static StreamCodec codec(ResourceLocation id, int maxBytes) { - return CustomPacketPayload.codec((discardedpayload, packetdataserializer) -> { -+ packetdataserializer.writeBytes(discardedpayload.data); // CraftBukkit - serialize - }, (packetdataserializer) -> { - int j = packetdataserializer.readableBytes(); - - if (j >= 0 && j <= maxBytes) { -- packetdataserializer.skipBytes(j); + public static StreamCodec codec(ResourceLocation id, int maxSize) { +- return CustomPacketPayload.codec((value, output) -> {}, buffer -> { ++ return CustomPacketPayload.codec((value, output) -> { ++ output.writeBytes(value.data); // CraftBukkit - serialize ++ }, buffer -> { + int i = buffer.readableBytes(); + if (i >= 0 && i <= maxSize) { + buffer.skipBytes(i); - return new DiscardedPayload(id); -+ // CraftBukkit start -+ return new DiscardedPayload(id, packetdataserializer.readBytes(j)); -+ // CraftBukkit end ++ return new DiscardedPayload(id, buffer.readBytes(i)); // CraftBukkit } else { - throw new IllegalArgumentException("Payload may not be larger than " + maxBytes + " bytes"); + throw new IllegalArgumentException("Payload may not be larger than " + maxSize + " bytes"); } diff --git a/paper-server/patches/unapplied/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch b/paper-server/patches/unapplied/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch deleted file mode 100644 index e17dc6200b..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java -+++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java -@@ -2,7 +2,6 @@ - - import com.google.common.collect.Lists; - import java.util.List; --import net.minecraft.Util; - import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.codec.StreamCodec; - import net.minecraft.network.protocol.Packet; -@@ -16,8 +15,7 @@ - private static final int MAX_PAYLOAD_SIZE = 32767; - public static final StreamCodec STREAM_CODEC = CustomPacketPayload.codec((minecraftkey) -> { - return DiscardedPayload.codec(minecraftkey, 32767); -- }, (List) Util.make(Lists.newArrayList(new CustomPacketPayload.TypeAndCodec[]{new CustomPacketPayload.TypeAndCodec<>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)}), (arraylist) -> { -- })).map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); -+ }, java.util.Collections.emptyList()).map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload); // CraftBukkit - treat all packets the same - - @Override - public PacketType type() {