From 44567fd8b010f86c919c99558d84dbb92a457368 Mon Sep 17 00:00:00 2001 From: Luna <90072930+LunaWasFlaggedAgain@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:45:47 -0300 Subject: [PATCH] Remove packet overflow console error (#135) --- patches/server/0014-Block-server-side-chunkbans.patch | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/patches/server/0014-Block-server-side-chunkbans.patch b/patches/server/0014-Block-server-side-chunkbans.patch index 189554c..013e808 100644 --- a/patches/server/0014-Block-server-side-chunkbans.patch +++ b/patches/server/0014-Block-server-side-chunkbans.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Block server-side chunkbans diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce5148b800 100644 +index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc44995e877b2 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -6,9 +6,17 @@ import io.netty.channel.ChannelHandlerContext; @@ -50,7 +50,7 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception { ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get(); if (connectionProtocol == null) { -@@ -33,38 +58,66 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -33,38 +58,59 @@ public class PacketEncoder extends MessageToByteEncoder> { throw new IOException("Can't serialize unregistered packet"); } else { FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); @@ -103,8 +103,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce + packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag()); + } else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) { + chunkPacket.clearNBT(); -+ } else if (packet instanceof ClientboundSetEntityDataPacket) { -+ return null; // Skip + } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) { + packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY); + } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) { @@ -113,10 +111,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce + packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY); + } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) { + packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null); -+ } else if (packet instanceof ClientboundSystemChatPacket) { -+ return null; -+ } else if (packet instanceof ClientboundDisguisedChatPacket) { -+ return null; + } else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) { + final SignedMessageBody.Packed body = playerChatPacket.body(); + packet = new ClientboundPlayerChatPacket(playerChatPacket.sender(), // Not sending this packet results in a kick when someone says something. @@ -128,7 +122,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce + playerChatPacket.chatType() + ); + } else { -+ LOGGER.error("Packet with ID {} was too large and was not caught. Please report this to the Scissors developers.", i); + return null; + } +