Improve the don't save entities patch per leafs feedback

This commit is contained in:
Aikar
2020-04-12 18:29:52 -04:00
parent c096fe19fa
commit 748e6447e3
10 changed files with 99 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
From 141395a5db93ca1716ceeff875c0c807636d9c06 Mon Sep 17 00:00:00 2001
From b11c11c4f13fe9c13a941bb25693801f935a5d69 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 13 Jul 2019 09:23:10 -0700
Subject: [PATCH] Asynchronous chunk IO and loading
@@ -2569,7 +2569,7 @@ index b582171c5..03d7ce829 100644
} finally {
playerChunkMap.callbackExecutor.run();
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 8816c90e2..0b61ee3ba 100644
index 8816c90e2..1298a07dc 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
@@ -2785,24 +2785,16 @@ index 8816c90e2..0b61ee3ba 100644
if (chunksection != Chunk.a || nibblearray != null || nibblearray1 != null) {
nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setByte("Y", (byte) (i & 255));
@@ -329,9 +448,13 @@ public class ChunkRegionLoader {
}
// Paper start - move entities to the correct chunk
- for (Entity entity : toUpdate) {
- worldserver.chunkCheck(entity);
- }
+ worldserver.getMinecraftServer().execute(() -> {
+ for (Entity entity : toUpdate) {
+ if (!entity.dead) {
+ worldserver.chunkCheck(entity);
+ }
+ }
+ });
// Paper end
} else {
@@ -353,24 +476,32 @@ public class ChunkRegionLoader {
@@ -313,7 +432,7 @@ public class ChunkRegionLoader {
Entity entity = (Entity) iterator1.next();
NBTTagCompound nbttagcompound4 = new NBTTagCompound();
// Paper start
- if ((int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) {
+ if (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) {
toUpdate.add(entity);
continue;
}
@@ -353,24 +472,32 @@ public class ChunkRegionLoader {
}
nbttagcompound1.set("Entities", nbttaglist2);
@@ -3991,7 +3983,7 @@ index c999f8c9b..b59ef1a63 100644
HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index df7503a5e..d4ef2403d 100644
index 4ddd8fd04..b5daebe51 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -82,6 +82,79 @@ public class WorldServer extends World {