Skip to content

Commit

Permalink
Updated Upstream (CraftBukkit)
Browse files Browse the repository at this point in the history
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:
bb6f384 SPIGOT-4534: Only call event for new chunks
  • Loading branch information
electronicboy committed Dec 17, 2018
1 parent 3496f2d commit 1f59f78
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
17 changes: 12 additions & 5 deletions 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 <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes
Expand All @@ -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 {
Expand All @@ -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<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;
- }
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions 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 <aikar@aikar.co>
Date: Sat, 29 Sep 2018 01:18:16 -0400
Subject: [PATCH] Fix Sending Chunks to Client
Expand All @@ -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() {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion work/CraftBukkit
Submodule CraftBukkit updated from 38cf67 to bb6f38

0 comments on commit 1f59f78

Please sign in to comment.