mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-26 22:55:39 +00:00
Remove packet overflow console error (#135)
This commit is contained in:
parent
1111ffabd7
commit
44567fd8b0
@ -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
|
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
|
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||||
+++ b/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;
|
@@ -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 {
|
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
|
||||||
ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get();
|
ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get();
|
||||||
if (connectionProtocol == null) {
|
if (connectionProtocol == null) {
|
||||||
@@ -33,38 +58,66 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
@@ -33,38 +58,59 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
|
||||||
throw new IOException("Can't serialize unregistered packet");
|
throw new IOException("Can't serialize unregistered packet");
|
||||||
} else {
|
} else {
|
||||||
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
|
||||||
@ -103,8 +103,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce
|
|||||||
+ packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag());
|
+ packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag());
|
||||||
+ } else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) {
|
+ } else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) {
|
||||||
+ chunkPacket.clearNBT();
|
+ chunkPacket.clearNBT();
|
||||||
+ } else if (packet instanceof ClientboundSetEntityDataPacket) {
|
|
||||||
+ return null; // Skip
|
|
||||||
+ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) {
|
+ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) {
|
||||||
+ packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY);
|
+ packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY);
|
||||||
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
+ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) {
|
||||||
@ -113,10 +111,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..c9c0652a22760716f9dbb5fc73bc6fce
|
|||||||
+ packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY);
|
+ packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY);
|
||||||
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
+ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) {
|
||||||
+ packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null);
|
+ 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) {
|
+ } else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) {
|
||||||
+ final SignedMessageBody.Packed body = playerChatPacket.body();
|
+ final SignedMessageBody.Packed body = playerChatPacket.body();
|
||||||
+ packet = new ClientboundPlayerChatPacket(playerChatPacket.sender(), // Not sending this packet results in a kick when someone says something.
|
+ 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()
|
+ playerChatPacket.chatType()
|
||||||
+ );
|
+ );
|
||||||
+ } else {
|
+ } else {
|
||||||
+ LOGGER.error("Packet with ID {} was too large and was not caught. Please report this to the Scissors developers.", i);
|
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
Loading…
Reference in New Issue
Block a user