mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
36f34f01c0
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
55 lines
2.5 KiB
Diff
55 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
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/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
index a0b87f89df77ba8ac6ce3f135d4f3a34ed2b3543..23223f3f45210cf23f44f9012f292db80df781a0 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
|
@@ -23,6 +23,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
|
|
|
public PacketPlayOutMapChunk() {}
|
|
|
|
+ // Paper start
|
|
+ private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
|
|
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
|
|
+
|
|
+ @Override
|
|
+ public java.util.List<Packet> getExtraPackets() {
|
|
+ return extraPackets;
|
|
+ }
|
|
+ // Paper end
|
|
public PacketPlayOutMapChunk(Chunk chunk, int i) {
|
|
ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
|
|
|
|
@@ -49,6 +58,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
|
this.c = this.a(new PacketDataSerializer(this.j()), chunk, i);
|
|
this.g = Lists.newArrayList();
|
|
iterator = chunk.getTileEntities().entrySet().iterator();
|
|
+ int totalTileEntities = 0; // Paper
|
|
|
|
while (iterator.hasNext()) {
|
|
entry = (Entry) iterator.next();
|
|
@@ -57,6 +67,15 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
|
int j = blockposition.getY() >> 4;
|
|
|
|
if (this.f() || (i & 1 << j) != 0) {
|
|
+ // Paper start - improve oversized chunk data packet handling
|
|
+ if (++totalTileEntities > TE_LIMIT) {
|
|
+ PacketPlayOutTileEntityData updatePacket = tileentity.getUpdatePacket();
|
|
+ if (updatePacket != null) {
|
|
+ this.extraPackets.add(updatePacket);
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
NBTTagCompound nbttagcompound = tileentity.b();
|
|
if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper
|
|
|