From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 6 May 2020 05:00:57 -0400 Subject: [PATCH] Handle Oversized Tile Entities in chunks Splits out Extra Packets if too many TE's are encountered to prevent creating too large of a packet to sed. Co authored by Spottedleaf diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java @@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacket implements Packet extraPackets = new java.util.ArrayList<>(); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); + @Override + public java.util.List getExtraPackets() { + return extraPackets; + } + // Paper end public ClientboundLevelChunkPacket(LevelChunk chunk, int includedSectionsMask) { ChunkPos chunkcoordintpair = chunk.getPos(); @@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacket implements Packet> 4; if (this.isFullChunk() || (includedSectionsMask & 1 << j) != 0) { + // Paper start - improve oversized chunk data packet handling + if (++totalTileEntities > TE_LIMIT) { + ClientboundBlockEntityDataPacket updatePacket = tileentity.getUpdatePacket(); + if (updatePacket != null) { + this.extraPackets.add(updatePacket); + continue; + } + } + // Paper end CompoundTag nbttagcompound = tileentity.getUpdateTag(); if (tileentity instanceof SkullBlockEntity) { SkullBlockEntity.sanitizeTileEntityUUID(nbttagcompound); } // Paper