From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sun, 16 Jun 2024 15:38:49 -0500 Subject: [PATCH] Add more fallback code for chunk bans diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java index 5d3e739d28d394ed59fe0003245cc55ac62e6087..e721aa95e0e11455df2fb337978cefdd1bbcf018 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundBlockEntityDataPacket.java @@ -1,6 +1,8 @@ package net.minecraft.network.protocol.game; import java.util.function.BiFunction; + +import me.totalfreedom.scissors.NbtUtility; import net.minecraft.core.BlockPos; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; @@ -36,6 +38,23 @@ public class ClientboundBlockEntityDataPacket implements Packet blockEntityType, CompoundTag nbt) { this.pos = pos; this.type = blockEntityType; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java index 63f6a2437da9363786b55af0a7cbc5373232d35b..38e8e3e58821da896851a42d6088bc70857ae7e1 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java @@ -43,6 +43,19 @@ public class ClientboundContainerSetSlotPacket implements Packet type() { return GamePacketTypes.CLIENTBOUND_MAP_ITEM_DATA; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java index 37ab438ab37b9235666ae69376509bdde7722d87..b6cdadfbfe8756a3fd10b7a2d93da31701bc44e1 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerChatPacket.java @@ -2,6 +2,8 @@ package net.minecraft.network.protocol.game; import java.util.UUID; import javax.annotation.Nullable; + +import net.minecraft.ChatFormatting; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.ChatType; @@ -39,6 +41,19 @@ public record ClientboundPlayerChatPacket( ); } + // Scissors start - Handle large packets disconnecting client + @Override + public boolean hasLargePacketFallback() { + return true; + } + + @Override + public boolean packetTooLarge(net.minecraft.network.Connection manager) { + manager.send(new ClientboundPlayerChatPacket(sender, index, signature, body, Component.empty().append("** Message too large **").withStyle(ChatFormatting.RED), filterMask, chatType)); + return true; + } + // Scissors end - Handle large packets disconnecting client + private void write(RegistryFriendlyByteBuf buf) { buf.writeUUID(this.sender); buf.writeVarInt(this.index); diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java index 3945ca04ede578121b370592482ac917f2d4cf96..f05678ab6fc598da0416c6e0c68bc30a1beef139 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java @@ -2,6 +2,8 @@ package net.minecraft.network.protocol.game; import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; + +import java.util.Collections; import java.util.List; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; @@ -44,6 +46,19 @@ public class ClientboundSetEquipmentPacket implements Packet