From ef4443e1e0de1e2f07db588671a56c576e4b1b15 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 17 Dec 2018 23:51:44 +0000 Subject: [PATCH] Updated Upstream (CraftBukkit) 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 CraftBukkit Changes: bb6f384a SPIGOT-4534: Only call event for new chunks --- .../Entity-add-to-world-fixes.patch | 13 ++++++++++--- .../Fix-Sending-Chunks-to-Client.patch | 2 +- work/CraftBukkit | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/Entity-add-to-world-fixes.patch index dc630d999e..d00a8a8532 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 4f01140e7..57e35564a 100644 +index 37bb6f40c..ee4332eda 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 { @@ -32,7 +32,7 @@ index 4f01140e7..57e35564a 100644 - - List toRemove = new LinkedList<>(); - this.world.a(entityslice.stream().filter((entity) -> { -- if (!CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { +- if (this.needsDecoration && !CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { // Only call for new chunks - toRemove.add(entity); - return false; - } @@ -42,7 +42,14 @@ index 4f01140e7..57e35564a 100644 // CraftBukkit end } + this.world.addChunkEntities(toAdd.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) -+ .filter((entity) -> CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) // Paper - Inline into stream ++ // Paper start - Inline event into stream ++ .filter((entity) -> { ++ if (!this.needsDecoration) { ++ return true; ++ } ++ return CraftEventFactory.doEntityAddEventCalling(this.world, entity, CreatureSpawnEvent.SpawnReason.CHUNK_GEN); ++ }) ++ // 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 start diff --git a/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch b/Spigot-Server-Patches/Fix-Sending-Chunks-to-Client.patch index 20dd7ee292..91730aa252 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 aa7f01f19..e3d97757f 100644 +index 7972e6955..7851ede7a 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 { diff --git a/work/CraftBukkit b/work/CraftBukkit index 38cf676e32..bb6f384a83 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 38cf676e328d869f8d5cded4d9e9ad3d75afb760 +Subproject commit bb6f384a830548def9c73264dab1a4d06fc2bdf4