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
This commit is contained in:
Shane Freeder 2018-12-17 23:51:44 +00:00
parent 21ae8ff67e
commit ef4443e1e0
3 changed files with 12 additions and 5 deletions

View File

@ -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<Entity> 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

View File

@ -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 {

@ -1 +1 @@
Subproject commit 38cf676e328d869f8d5cded4d9e9ad3d75afb760
Subproject commit bb6f384a830548def9c73264dab1a4d06fc2bdf4