aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch')
-rw-r--r--patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch66
1 files changed, 0 insertions, 66 deletions
diff --git a/patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch b/patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch
deleted file mode 100644
index 004b1e4677..0000000000
--- a/patches/server/1060-fixup-Handle-Large-Packets-disconnecting-client.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Spottedleaf <[email protected]>
-Date: Tue, 23 Apr 2024 02:01:59 -0700
-Subject: [PATCH] fixup! Handle Large Packets disconnecting client
-
-
-diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
-index 96d5448019d53ac3575e209c1c5c223a62a2638d..f396ca17e65138f5d128490b05bcd2f9c1d46ef5 100644
---- a/src/main/java/net/minecraft/network/PacketEncoder.java
-+++ b/src/main/java/net/minecraft/network/PacketEncoder.java
-@@ -63,7 +63,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
- } finally {
- // Paper start - Handle large packets disconnecting client
- int packetLength = friendlyByteBuf.readableBytes();
-- if (packetLength > MAX_PACKET_SIZE) {
-+ if (packetLength > MAX_PACKET_SIZE || (packetLength > MAX_FINAL_PACKET_SIZE && packet.hasLargePacketFallback())) {
- throw new PacketTooLargeException(packet, this.codecKey, packetLength);
- }
- // Paper end - Handle large packets disconnecting client
-@@ -74,7 +74,10 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
- }
-
- // Paper start
-- private static int MAX_PACKET_SIZE = 8388608;
-+ // packet size is encoded into 3-byte varint
-+ private static final int MAX_FINAL_PACKET_SIZE = (1 << 21) - 1;
-+ // Vanilla Max size for the encoder (before compression)
-+ private static final int MAX_PACKET_SIZE = 8388608;
-
- public static class PacketTooLargeException extends RuntimeException {
- private final Packet<?> packet;
-diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java
-index da11266a0a23f446196e6facf2c358cfcc18070f..9915e5996b9bf4b94653d0c2f612806db5c43485 100644
---- a/src/main/java/net/minecraft/network/protocol/Packet.java
-+++ b/src/main/java/net/minecraft/network/protocol/Packet.java
-@@ -35,6 +35,14 @@ public interface Packet<T extends PacketListener> {
- default java.util.List<Packet<?>> getExtraPackets() {
- return null;
- }
-+
-+ default boolean hasLargePacketFallback() {
-+ return false;
-+ }
-+
-+ /**
-+ * override {@link #hasLargePacketFallback()} to return true when overriding in subclasses
-+ */
- default boolean packetTooLarge(net.minecraft.network.Connection manager) {
- return false;
- }
-diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
-index 6765175c98d52e5cbc191e88e0d545a05606dfd4..3d52fd6de8b33e45450bb601697920bf94493fb9 100644
---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
-+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
-@@ -32,6 +32,11 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
- }
-
- // Paper start
-+ @Override
-+ public boolean hasLargePacketFallback() {
-+ return true;
-+ }
-+
- @Override
- public boolean packetTooLarge(net.minecraft.network.Connection manager) {
- for (int i = 0 ; i < this.items.size() ; i++) {