Add a config to turn off Optimized TickList #3145

Set:

settings:
  - use-optimized-ticklist: false

If you are having issues with block updates and want to see if this fixes it.

Please report confirmations on #3145 ticket
This commit is contained in:
Aikar 2020-04-26 04:01:03 -04:00
parent a96311595a
commit 985dbd1710
6 changed files with 54 additions and 18 deletions

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Delay unsafe actions until after entity ticking is done
This will help prevent many cases of unregistering entities during entity ticking
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 4b9b79a9..9e9a1b2a 100644
index dc01fb494d..d13dc8fce9 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 {
@ -44,7 +44,7 @@ index 4b9b79a9..9e9a1b2a 100644
try (co.aikar.timings.Timing ignored = this.timings.newEntities.startTiming()) { // Paper - timings
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1fbb1344..f56131e3 100644
index 1fbb1344fc..f56131e3a5 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 {

View file

@ -23,7 +23,7 @@ index 16f2e32d23..9cb4e5a1e6 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 de24b487d2..e198b8c565 100644
index 9b9e242432..f80c80957a 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 {

View file

@ -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 e198b8c565..b3e1e3686b 100644
index f80c80957a..3f8f40018d 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 {

View file

@ -42,7 +42,7 @@ index 223d3b1125..37341d2d2e 100644
public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions");
public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index f4836e2da1..a6107ba016 100644
index 647f6fc8ef..9f1662ece5 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +0,0 @@ public class PaperConfig {
@ -226,7 +226,7 @@ index 77adc64e30..3c25436f15 100644
// Spigot Start
CrashReport crashreport;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 142770bcd6..3f62fe2bb1 100644
index 532aba2a5d..dc01fb494d 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 {

View file

@ -41,6 +41,24 @@ and -Dpaper.ticklist-excessive-delay-threshold=ticks which
sets the excessive tick delay to the specified ticks (defaults to
60 * 20 ticks, aka 60 seconds)
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index f4836e2da1..647f6fc8ef 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +0,0 @@ public class PaperConfig {
maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier);
}
+ public static boolean useOptimizedTickList = true;
+ private static void useOptimizedTickList() {
+ if (config.contains("settings.use-optimized-ticklist")) { // don't add default, hopefully temporary config
+ useOptimizedTickList = config.getBoolean("settings.use-optimized-ticklist");
+ }
+ }
+
public static boolean asyncChunks = false;
private static void asyncChunks() {
ConfigurationSection section;
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
new file mode 100644
index 0000000000..ce653f6b4b
@ -877,7 +895,7 @@ index e650a2e48d..2d07d350d2 100644
return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 57e797cd86..2e63f64783 100644
index e67e006535..ca1b5b3b09 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
@ -1143,7 +1161,7 @@ index f533860bbe..3f1aa5ced6 100644
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 95860454da..b74f701b9e 100644
index 9a2b4fa7a2..9b9e242432 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 {
@ -1152,8 +1170,10 @@ index 95860454da..b74f701b9e 100644
+ // Paper start - rewrite ticklistserver
+ void onChunkSetTicking(int chunkX, int chunkZ) {
+ ((com.destroystokyo.paper.server.ticklist.PaperTickList)this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ);
+ ((com.destroystokyo.paper.server.ticklist.PaperTickList)this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ);
+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) {
+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ);
+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ);
+ }
+ }
+ // Paper end - rewrite ticklistserver
+
@ -1165,12 +1185,28 @@ index 95860454da..b74f701b9e 100644
worlddata.world = this;
// CraftBukkit end
- this.nextTickListBlock = new TickListServer<>(this, (block) -> {
+ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { // Paper - optimise TickListServer
return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings
- return block == null || block.getBlockData().isAir();
- }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings
- this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> {
+ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { // Paper - optimise TickListServer
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
}, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings
- return fluidtype == null || fluidtype == FluidTypes.EMPTY;
- }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings
+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) {
+ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { // Paper - optimise TickListServer
+ return block == null || block.getBlockData().isAir();
+ }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings
+ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { // Paper - optimise TickListServer
+ return fluidtype == null || fluidtype == FluidTypes.EMPTY;
+ }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings
+ } else {
+ this.nextTickListBlock = new TickListServer<>(this, (block) -> { // Paper - optimise TickListServer
+ return block == null || block.getBlockData().isAir();
+ }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings
+ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { // Paper - optimise TickListServer
+ return fluidtype == null || fluidtype == FluidTypes.EMPTY;
+ }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings
+ }
+
this.navigators = Sets.newHashSet();
this.I = new ObjectLinkedOpenHashSet();
this.dataManager = worldnbtstorage;
--

View file

@ -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 f570c40496..be75b9dd14 100644
index 7e7d7308f2..a61510c944 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 f570c40496..be75b9dd14 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 b3e1e3686b..142770bcd6 100644
index 3f8f40018d..532aba2a5d 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 {