From 1f59f78c6f1227be5d013f6b253a1f3913cee8cd 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 --- .../0321-Entity-add-to-world-fixes.patch | 17 ++++++++++++----- .../0374-Fix-Sending-Chunks-to-Client.patch | 8 ++++---- work/CraftBukkit | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Spigot-Server-Patches/0321-Entity-add-to-world-fixes.patch b/Spigot-Server-Patches/0321-Entity-add-to-world-fixes.patch index d7d3b33c3b..99e3999a8e 100644 --- a/Spigot-Server-Patches/0321-Entity-add-to-world-fixes.patch +++ b/Spigot-Server-Patches/0321-Entity-add-to-world-fixes.patch @@ -1,4 +1,4 @@ -From f91d23d40efa6bb6385549a9dd7a69a2c42fceed Mon Sep 17 00:00:00 2001 +From 9371f9dbc894ceb59d0a7fc7ac0df987c8c8b520 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 3 Aug 2018 22:47:46 -0400 Subject: [PATCH] Entity add to world fixes @@ -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 @@ -916,6 +916,7 @@ public class Chunk implements IChunkAccess { @@ -25,14 +25,14 @@ index 4f01140e7..57e35564a 100644 for (int j = 0; j < i; ++j) { // CraftBukkit start -@@ -964,18 +965,11 @@ public class Chunk implements IChunkAccess { +@@ -964,18 +965,18 @@ public class Chunk implements IChunkAccess { } } // Paper end - - 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/0374-Fix-Sending-Chunks-to-Client.patch b/Spigot-Server-Patches/0374-Fix-Sending-Chunks-to-Client.patch index f884a899c1..fee45d72a3 100644 --- a/Spigot-Server-Patches/0374-Fix-Sending-Chunks-to-Client.patch +++ b/Spigot-Server-Patches/0374-Fix-Sending-Chunks-to-Client.patch @@ -1,4 +1,4 @@ -From 201ce3d451f0e6fb3a7ee86019926e044b3f9512 Mon Sep 17 00:00:00 2001 +From 10a0113e0c7b2dfccbe5c385b2e9d76b7cf06786 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 29 Sep 2018 01:18:16 -0400 Subject: [PATCH] Fix Sending Chunks to Client @@ -14,10 +14,10 @@ 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 -@@ -1191,7 +1191,7 @@ public class Chunk implements IChunkAccess { +@@ -1198,7 +1198,7 @@ public class Chunk implements IChunkAccess { } public boolean isReady() { @@ -26,7 +26,7 @@ index aa7f01f19..e3d97757f 100644 } public boolean v() { -@@ -1429,6 +1429,13 @@ public class Chunk implements IChunkAccess { +@@ -1436,6 +1436,13 @@ public class Chunk implements IChunkAccess { this.h.clear(); this.a(ChunkStatus.POSTPROCESSED); this.m.a(this); 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