mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Improve the don't save entities patch per leafs feedback
This commit is contained in:
parent
bd4c6a566c
commit
73e413e403
@ -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
|
||||
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
@ -2786,22 +2786,14 @@ index 8816c90e2..0b61ee3ba 100644
|
||||
nbttagcompound2 = new NBTTagCompound();
|
||||
nbttagcompound2.setByte("Y", (byte) (i & 255));
|
||||
@@ -0,0 +0,0 @@ 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 {
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ChunkRegionLoader {
|
||||
}
|
||||
|
||||
@ -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
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world
|
||||
This lets you disable it for some worlds and lower it for others.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 572679e4d1..071e5e7f72 100644
|
||||
index 572679e4d..071e5e7f7 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
@ -21,7 +21,7 @@ index 572679e4d1..071e5e7f72 100644
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3ede5ce2a6..eaa26e1a50 100644
|
||||
index 3ede5ce2a..eaa26e1a5 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
@ -72,7 +72,7 @@ index 3ede5ce2a6..eaa26e1a50 100644
|
||||
// CraftBukkit start
|
||||
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldLoadListener.java b/src/main/java/net/minecraft/server/WorldLoadListener.java
|
||||
index d6762d3853..7b6f5b2da0 100644
|
||||
index d6762d385..7b6f5b2da 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldLoadListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldLoadListener.java
|
||||
@@ -0,0 +0,0 @@ public interface WorldLoadListener {
|
||||
@ -83,7 +83,7 @@ index d6762d3853..7b6f5b2da0 100644
|
||||
+ void setChunkRadius(int radius); // Paper - allow changing chunk radius
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java
|
||||
index 3868572aed..ae77805f71 100644
|
||||
index 3868572ae..ae77805f7 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java
|
||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||
@ -114,7 +114,7 @@ index 3868572aed..ae77805f71 100644
|
||||
@Override
|
||||
public void a(ChunkCoordIntPair chunkcoordintpair) {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index ff58e0190e..4ccc35d614 100644
|
||||
index fa7709122..0cba585cf 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@ -207,7 +207,7 @@ index ff58e0190e..4ccc35d614 100644
|
||||
|
||||
public LongSet getForceLoadedChunks() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 8b6d22e710..661a89c5d6 100644
|
||||
index 8b6d22e71..661a89c5d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
@ -11,7 +11,7 @@ Vs behavior of non ticking of just overwriting state.
|
||||
We will now simply log a warning when this happens instead of crashing the server.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 65457c89ad..6571cf1eee 100644
|
||||
index 16f2e32d2..9cb4e5a1e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@ -23,7 +23,7 @@ index 65457c89ad..6571cf1eee 100644
|
||||
private boolean locked = false;
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 5ba46fca55..23527809ce 100644
|
||||
index 5b644db97..ed6599ca1 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -15,7 +15,7 @@ Combine that with a buggy detail of the previous implementation of
|
||||
the Dupe UUID patch, then this was the likely source of the "Ghost entities"
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 23527809ce..941eee838b 100644
|
||||
index ed6599ca1..ce1075e5a 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since
|
||||
they shouldn't of been in the list in the first place.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index b839769cea..5acad8e44f 100644
|
||||
index b839769ce..5acad8e44 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -0,0 +0,0 @@ public class PaperCommand extends Command {
|
||||
@ -23,7 +23,7 @@ index b839769cea..5acad8e44f 100644
|
||||
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 3267e87259..a51de83cf5 100644
|
||||
index 3267e8725..a51de83cf 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 {
|
||||
@ -51,7 +51,7 @@ index 3267e87259..a51de83cf5 100644
|
||||
if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
|
||||
list.add(t0);
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 356de07dad..33cd7f7b40 100644
|
||||
index 356de07da..33cd7f7b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@ -63,7 +63,7 @@ index 356de07dad..33cd7f7b40 100644
|
||||
public float getBukkitYaw() {
|
||||
return this.yaw;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 6ce7f77a5e..c13aefff94 100644
|
||||
index 1adabb751..56de91008 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@ -92,7 +92,7 @@ index 6ce7f77a5e..c13aefff94 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 588c87119f..e94ac028df 100644
|
||||
index 588c87119..e94ac028d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Limit lightning strike effect distance
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 487b0d5cd6..b8789c8ecc 100644
|
||||
index 487b0d5cd..b8789c8ec 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
@ -38,7 +38,7 @@ index 487b0d5cd6..b8789c8ecc 100644
|
||||
private void fixedInhabitedTime() {
|
||||
if (PaperConfig.version < 16) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
index 7c518983a9..bdb534deb4 100644
|
||||
index 7c518983a..bdb534deb 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
@@ -0,0 +0,0 @@ public class EntityLightning extends Entity {
|
||||
@ -69,7 +69,7 @@ index 7c518983a9..bdb534deb4 100644
|
||||
|
||||
--this.lifeTicks;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 2b2b547034..7364f48210 100644
|
||||
index 3f74a34d8..577043c74 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Mark entities as being ticked when notifying navigation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 4b65a232ff..df7503a5ec 100644
|
||||
index 2287453b7..4ddd8fd04 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding
|
||||
Stack will identify any causer of this and warn instead of crashing.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 0186ab9e40..e1e4ea793a 100644
|
||||
index 0186ab9e4..e1e4ea793 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@ -26,7 +26,7 @@ index 0186ab9e40..e1e4ea793a 100644
|
||||
if (!(entity instanceof EntityLightning)) {
|
||||
EntityTypes<?> entitytypes = entity.getEntityType();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 941eee838b..c7ec8cbc11 100644
|
||||
index ce1075e5a..6a5520ee2 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
|
@ -79,4 +79,45 @@ index 4af5a230b..83bcef7e6 100644
|
||||
|
||||
public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 6ce7f77a5..1adabb751 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
List[] aentityslice = chunk.getEntitySlices(); // Spigot
|
||||
int i = aentityslice.length;
|
||||
|
||||
+ java.util.List<Entity> toMoveChunks = new java.util.ArrayList<>(); // Paper
|
||||
for (int j = 0; j < i; ++j) {
|
||||
List<Entity> entityslice = aentityslice[j]; // Spigot
|
||||
Iterator iterator = entityslice.iterator();
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!"));
|
||||
}
|
||||
|
||||
+ // Paper start - move out entities that shouldn't be in this chunk before it unloads
|
||||
+ if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) {
|
||||
+ toMoveChunks.add(entity);
|
||||
+ entity.inChunk = false;
|
||||
+ entity.entitySlice = null;
|
||||
+ iterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.entitiesById.remove(entity.getId());
|
||||
this.unregisterEntity(entity);
|
||||
+
|
||||
+ if (entity.dead) iterator.remove(); // Paper - don't save dead entities during unload
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start - move out entities that shouldn't be in this chunk before it unloads
|
||||
+ for (Entity entity : toMoveChunks) {
|
||||
+ this.chunkCheck(entity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
||||
--
|
@ -5,7 +5,7 @@ Subject: [PATCH] Send nearby packets from world player list not server list
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 442673b13f..36d31d271c 100644
|
||||
index 442673b13..36d31d271 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
@ -46,7 +46,7 @@ index 442673b13f..36d31d271c 100644
|
||||
double d5 = d1 - entityplayer.locY();
|
||||
double d6 = d2 - entityplayer.locZ();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index c13aefff94..2b2b547034 100644
|
||||
index 56de91008..3f74a34d8 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -0,0 +0,0 @@ public class WorldServer extends World {
|
||||
@ -68,7 +68,7 @@ index c13aefff94..2b2b547034 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index e94ac028df..d61769b4f2 100644
|
||||
index e94ac028d..d61769b4f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
Loading…
Reference in New Issue
Block a user