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
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
10 changed files with 99 additions and 66 deletions

View file

@ -1,4 +1,4 @@
From 0e1e8bae2d4aa584614af1937310c93dd0384a88 Mon Sep 17 00:00:00 2001 From 3c6d8305c8007d43baa346e7509fa87793f59c1d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 26 Jul 2018 00:11:12 -0400 Date: Thu, 26 Jul 2018 00:11:12 -0400
Subject: [PATCH] Prevent Saving Bad entities to chunks Subject: [PATCH] Prevent Saving Bad entities to chunks
@ -79,6 +79,47 @@ index 4af5a230b..83bcef7e6 100644
public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
if (nbttagcompound != null) { 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
@@ -1085,6 +1085,7 @@ 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();
@@ -1109,11 +1110,28 @@ 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
}
-- --
2.25.1 2.25.1

View file

@ -1,4 +1,4 @@
From 43c1459292e3c2c7f57b4c716b84346ea7f4b757 Mon Sep 17 00:00:00 2001 From d74308ea9718ce70c654463ae2cbc74e8dbad111 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400 Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -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. 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 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 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -179,6 +179,7 @@ public class PaperCommand extends Command { @@ -179,6 +179,7 @@ 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())); MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); 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 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 --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -682,6 +682,7 @@ public class Chunk implements IChunkAccess { @@ -682,6 +682,7 @@ 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 if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
list.add(t0); list.add(t0);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -195,6 +195,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -195,6 +195,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -63,7 +63,7 @@ index 356de07dad..33cd7f7b40 100644
public float getBukkitYaw() { public float getBukkitYaw() {
return this.yaw; return this.yaw;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -908,7 +908,7 @@ public class WorldServer extends World { @@ -908,7 +908,7 @@ public class WorldServer extends World {
@ -75,7 +75,7 @@ index 6ce7f77a5e..c13aefff94 100644
if (entity instanceof EntityInsentient) { if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity; EntityInsentient entityinsentient = (EntityInsentient) entity;
@@ -1229,6 +1229,7 @@ public class WorldServer extends World { @@ -1247,6 +1247,7 @@ public class WorldServer extends World {
entity.origin = entity.getBukkitEntity().getLocation(); entity.origin = entity.getBukkitEntity().getLocation();
} }
// Paper end // Paper end
@ -83,7 +83,7 @@ index 6ce7f77a5e..c13aefff94 100644
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
} }
@@ -1241,6 +1242,7 @@ public class WorldServer extends World { @@ -1259,6 +1260,7 @@ public class WorldServer extends World {
this.removeEntityFromChunk(entity); this.removeEntityFromChunk(entity);
this.entitiesById.remove(entity.getId()); this.entitiesById.remove(entity.getId());
this.unregisterEntity(entity); this.unregisterEntity(entity);
@ -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 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1025,6 +1025,7 @@ public class CraftWorld implements World { @@ -1025,6 +1025,7 @@ public class CraftWorld implements World {

View file

@ -1,11 +1,11 @@
From 46abe17c2e2707fc80b5d0625708b27a48c0b396 Mon Sep 17 00:00:00 2001 From 902e2759616eb41c26ad90bc2efd0358719e4338 Mon Sep 17 00:00:00 2001
From: Mystiflow <mystiflow@gmail.com> From: Mystiflow <mystiflow@gmail.com>
Date: Fri, 6 Jul 2018 13:21:30 +0100 Date: Fri, 6 Jul 2018 13:21:30 +0100
Subject: [PATCH] Send nearby packets from world player list not server list 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 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 --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -923,8 +923,25 @@ public abstract class PlayerList { @@ -923,8 +923,25 @@ public abstract class PlayerList {
@ -46,10 +46,10 @@ index 442673b13f..36d31d271c 100644
double d5 = d1 - entityplayer.locY(); double d5 = d1 - entityplayer.locY();
double d6 = d2 - entityplayer.locZ(); 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 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1275,7 +1275,7 @@ public class WorldServer extends World { @@ -1293,7 +1293,7 @@ public class WorldServer extends World {
} }
// CraftBukkit end // CraftBukkit end
this.globalEntityList.add(entitylightning); this.globalEntityList.add(entitylightning);
@ -58,7 +58,7 @@ index c13aefff94..2b2b547034 100644
} }
@Override @Override
@@ -1407,7 +1407,7 @@ public class WorldServer extends World { @@ -1425,7 +1425,7 @@ public class WorldServer extends World {
BlockActionData blockactiondata = (BlockActionData) this.I.removeFirst(); BlockActionData blockactiondata = (BlockActionData) this.I.removeFirst();
if (this.a(blockactiondata)) { if (this.a(blockactiondata)) {
@ -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 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2120,7 +2120,7 @@ public class CraftWorld implements World { @@ -2120,7 +2120,7 @@ public class CraftWorld implements World {

View file

@ -1,11 +1,11 @@
From 1c9e14d9d0bbcce702c47f2efc1e186569d91553 Mon Sep 17 00:00:00 2001 From 04983f017e812190f1de29ef50612ee72715fe65 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com> From: Trigary <trigary0@gmail.com>
Date: Fri, 14 Sep 2018 17:42:08 +0200 Date: Fri, 14 Sep 2018 17:42:08 +0200
Subject: [PATCH] Limit lightning strike effect distance 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 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 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -242,6 +242,28 @@ public class PaperWorldConfig { @@ -242,6 +242,28 @@ public class PaperWorldConfig {
@ -38,7 +38,7 @@ index 487b0d5cd6..b8789c8ecc 100644
private void fixedInhabitedTime() { private void fixedInhabitedTime() {
if (PaperConfig.version < 16) { if (PaperConfig.version < 16) {
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java 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 --- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -64,6 +64,17 @@ public class EntityLightning extends Entity { @@ -64,6 +64,17 @@ public class EntityLightning extends Entity {
@ -69,10 +69,10 @@ index 7c518983a9..bdb534deb4 100644
--this.lifeTicks; --this.lifeTicks;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1275,7 +1275,7 @@ public class WorldServer extends World { @@ -1293,7 +1293,7 @@ public class WorldServer extends World {
} }
// CraftBukkit end // CraftBukkit end
this.globalEntityList.add(entitylightning); this.globalEntityList.add(entitylightning);

View file

@ -1,4 +1,4 @@
From da4c5cfa55eba970207231a87c45c13846d89a17 Mon Sep 17 00:00:00 2001 From 3d4c6a9cd4766057fcd6db19f504cba07be956f2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 13 Sep 2014 23:14:43 -0400 Date: Sat, 13 Sep 2014 23:14:43 -0400
Subject: [PATCH] Configurable Keep Spawn Loaded range per world Subject: [PATCH] Configurable Keep Spawn Loaded range per 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. 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 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 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -481,4 +481,10 @@ public class PaperWorldConfig { @@ -481,4 +481,10 @@ 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 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 --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -586,6 +586,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -586,6 +586,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -72,7 +72,7 @@ index 3ede5ce2a6..eaa26e1a50 100644
// CraftBukkit start // CraftBukkit start
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L; // 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 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 --- a/src/main/java/net/minecraft/server/WorldLoadListener.java
+++ b/src/main/java/net/minecraft/server/WorldLoadListener.java +++ b/src/main/java/net/minecraft/server/WorldLoadListener.java
@@ -9,4 +9,6 @@ public interface WorldLoadListener { @@ -9,4 +9,6 @@ public interface WorldLoadListener {
@ -83,7 +83,7 @@ index d6762d3853..7b6f5b2da0 100644
+ void setChunkRadius(int radius); // Paper - allow changing chunk radius + 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 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 --- a/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java
+++ b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java +++ b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java
@@ -7,16 +7,24 @@ import org.apache.logging.log4j.Logger; @@ -7,16 +7,24 @@ import org.apache.logging.log4j.Logger;
@ -114,10 +114,10 @@ index 3868572aed..ae77805f71 100644
@Override @Override
public void a(ChunkCoordIntPair chunkcoordintpair) { 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 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1583,13 +1583,85 @@ public class WorldServer extends World { @@ -1601,13 +1601,85 @@ public class WorldServer extends World {
return ((PersistentIdCounts) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); return ((PersistentIdCounts) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a();
} }
@ -207,7 +207,7 @@ index ff58e0190e..4ccc35d614 100644
public LongSet getForceLoadedChunks() { public LongSet getForceLoadedChunks() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1928,15 +1928,21 @@ public class CraftWorld implements World { @@ -1928,15 +1928,21 @@ public class CraftWorld implements World {

View file

@ -1,14 +1,14 @@
From b36f4cd63953f9f0b356992b12ee81457f519ae8 Mon Sep 17 00:00:00 2001 From 76bab2d2d7f1f05de240733c82fab37dbc60d0e6 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 28 Jul 2019 00:51:11 +0100 Date: Sun, 28 Jul 2019 00:51:11 +0100
Subject: [PATCH] Mark entities as being ticked when notifying navigation 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 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1397,6 +1397,7 @@ public class WorldServer extends World { @@ -1415,6 +1415,7 @@ public class WorldServer extends World {
VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition);
if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) {
@ -16,7 +16,7 @@ index 4b65a232ff..df7503a5ec 100644
Iterator iterator = this.navigators.iterator(); Iterator iterator = this.navigators.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1407,6 +1408,7 @@ public class WorldServer extends World { @@ -1425,6 +1426,7 @@ public class WorldServer extends World {
} }
} }

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

View file

@ -1,4 +1,4 @@
From 1c031ccb73652467d8913abedaebe704625644f1 Mon Sep 17 00:00:00 2001 From c28915808450a2ec9173915f0f47a0cebcbbe6a5 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 29 Mar 2020 18:26:14 -0400 Date: Sun, 29 Mar 2020 18:26:14 -0400
Subject: [PATCH] Ensure Entity is never double registered Subject: [PATCH] Ensure Entity is never double registered
@ -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. 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -59,6 +59,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -59,6 +59,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -23,7 +23,7 @@ index 65457c89ad..6571cf1eee 100644
private boolean locked = false; private boolean locked = false;
@Override @Override
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -520,6 +520,7 @@ public class WorldServer extends World { @@ -520,6 +520,7 @@ public class WorldServer extends World {
@ -34,7 +34,7 @@ index 5ba46fca55..23527809ce 100644
this.registerEntity(entity); this.registerEntity(entity);
} }
} // Paper - timings } // Paper - timings
@@ -1329,6 +1330,19 @@ public class WorldServer extends World { @@ -1347,6 +1348,19 @@ public class WorldServer extends World {
public void unregisterEntity(Entity entity) { public void unregisterEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot
@ -54,7 +54,7 @@ index 5ba46fca55..23527809ce 100644
// Spigot start // Spigot start
if ( entity instanceof EntityHuman ) if ( entity instanceof EntityHuman )
{ {
@@ -1390,9 +1404,21 @@ public class WorldServer extends World { @@ -1408,9 +1422,21 @@ public class WorldServer extends World {
private void registerEntity(Entity entity) { private void registerEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot

View file

@ -1,4 +1,4 @@
From 220db8b8d7cd74b1bff9fe451108c20ffe9d01ac Mon Sep 17 00:00:00 2001 From 276cdbbff63e0ee0671b2f0a53178fca15e81647 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 31 Mar 2020 03:01:45 -0400 Date: Tue, 31 Mar 2020 03:01:45 -0400
Subject: [PATCH] Fix unregistering entities from unloading chunks Subject: [PATCH] Fix unregistering entities from unloading chunks
@ -15,10 +15,10 @@ 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" 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 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1483,9 +1483,9 @@ public class WorldServer extends World { @@ -1501,9 +1501,9 @@ public class WorldServer extends World {
} }
private void removeEntityFromChunk(Entity entity) { private void removeEntityFromChunk(Entity entity) {

View file

@ -1,4 +1,4 @@
From 90fd57417baaed7e89b69b50d566f1c709867214 Mon Sep 17 00:00:00 2001 From 27cdad7a9321efaa5dc7ee8897bbf22086106b2d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 2 Apr 2020 01:42:39 -0400 Date: Thu, 2 Apr 2020 01:42:39 -0400
Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server
@ -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. 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 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 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1484,6 +1484,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -1484,6 +1484,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -26,10 +26,10 @@ index 0186ab9e40..e1e4ea793a 100644
if (!(entity instanceof EntityLightning)) { if (!(entity instanceof EntityLightning)) {
EntityTypes<?> entitytypes = entity.getEntityType(); EntityTypes<?> entitytypes = entity.getEntityType();
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java 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 --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1449,7 +1449,7 @@ public class WorldServer extends World { @@ -1467,7 +1467,7 @@ public class WorldServer extends World {
} }
} }
@ -38,7 +38,7 @@ index 941eee838b..c7ec8cbc11 100644
// CraftBukkit start - SPIGOT-5278 // CraftBukkit start - SPIGOT-5278
if (entity instanceof EntityDrowned) { if (entity instanceof EntityDrowned) {
this.navigators.add(((EntityDrowned) entity).navigationWater); this.navigators.add(((EntityDrowned) entity).navigationWater);
@@ -1460,6 +1460,7 @@ public class WorldServer extends World { @@ -1478,6 +1478,7 @@ public class WorldServer extends World {
this.navigators.add(((EntityInsentient) entity).getNavigation()); this.navigators.add(((EntityInsentient) entity).getNavigation());
} }
entity.valid = true; // CraftBukkit entity.valid = true; // CraftBukkit