From 1cd0cdf54399b5e3b2e67a2c3e6abb9b90187f8d Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 18 Dec 2018 02:07:05 +0000 Subject: [PATCH] Cleanup Entity add to world fixes --- .../Entity-add-to-world-fixes.patch | 13 ++----------- .../Fix-Sending-Chunks-to-Client.patch | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch index 8596333e56..515c24cce4 100644 --- a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch @@ -14,7 +14,7 @@ Fix this by differing entity add to world for all entities at the same time the original entity is dead, overwrite it as the logic does for unloaod queued entities. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 37bb6f40c..414c27516 100644 +index 37bb6f40c..55104d00f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -26,14 +26,6 @@ index 37bb6f40c..414c27516 100644 import java.util.HashMap; import java.util.UUID; // Paper end -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - this.world.a(this.tileEntities.values()); - List[] aentityslice = this.entitySlices; // Spigot - int i = aentityslice.length; -+ List toAdd = new java.util.ArrayList<>(32); // Paper - - for (int j = 0; j < i; ++j) { - // CraftBukkit start @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { } } @@ -48,7 +40,6 @@ index 37bb6f40c..414c27516 100644 - return !(entity instanceof EntityHuman); - })); - entityslice.removeAll(toRemove); - // CraftBukkit end + this.world.addChunkEntities(entityslice.stream() // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen) + // Paper start - Inline event into stream + .filter((entity) -> { @@ -59,9 +50,9 @@ index 37bb6f40c..414c27516 100644 + }) + // Paper end - Inline event into stream + .filter((entity) -> !(entity instanceof EntityHuman || entity.valid))); // Paper - add all at same time to avoid entities adding to world modifying slice state, skip already added entities (not normal, but can happen) + // CraftBukkit end } - // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 5e61826f6..bd6f64e52 100644 --- a/src/main/java/net/minecraft/server/World.java diff --git a/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch b/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch index a625a29f2c..5208ff165f 100644 --- a/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch +++ b/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch @@ -14,7 +14,7 @@ This fix always sends chunks to the client, and simply updates the client anytime post processing is triggered with the new chunk data. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ccdc171d4..7751ae444 100644 +index 2253092a9..811a63e04 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {