diff options
author | Jason Penilla <[email protected]> | 2022-03-02 11:24:32 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2022-03-02 11:24:32 -0700 |
commit | 90788a556c6fb4a39919da2c440080b5daffe950 (patch) | |
tree | a672bded0e8251cfd545e4aaeba22b33cec99701 | |
parent | 12d89fe5aec699dedbf529d1dc57b0deddb22409 (diff) | |
download | Paper-90788a556c6fb4a39919da2c440080b5daffe950.tar.gz Paper-90788a556c6fb4a39919da2c440080b5daffe950.zip |
clean up prepareTickingChunk diff
10 files changed, 42 insertions, 77 deletions
diff --git a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch index 23939da803..f3f4e5d8b2 100644 --- a/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/patches/server/0403-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -8,7 +8,7 @@ See: https://gist.github.com/aikar/dd22bbd2a3d78a2fd3d92e95e9f28dc6 as part of post processing a chunk, we can call ChunkConverter. ChunkConverter then kicks off major physics updates, and when blocks -that have connections across chunk boundries occur, a recursive risk +that have connections across chunk boundaries occur, a recursive risk can occur where A updates a block that triggers a physics request. That physics request may trigger a chunk request, that then enqueues @@ -21,42 +21,11 @@ will be unable to proceed. We delay post processing of Chunk.A() 1 "pass" by re stuffing it back into the executor so that the mailbox ChunkQueue is now considered empty. -This successfully fixed a reoccurring and highly reproduceable crash +This successfully fixed a reoccurring and highly reproducible crash for heightmaps. -TODO FOR LEAF: 1.18.2 changed this - -OLD - - CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> { - return either.flatMap((list) -> { - LevelChunk chunk = (LevelChunk) list.get(list.size() / 2); - - chunk.postProcessGeneration(); - this.level.startTickingChunk(chunk); - return Either.left(chunk); - }); - }, (runnable) -> { - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. - }); - -NEW - - CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> { - return either.mapLeft((list) -> { - return (LevelChunk) list.get(list.size() / 2); - }); - }, (runnable) -> { - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. - }).thenApplyAsync((either) -> { - return either.ifLeft((chunk) -> { - chunk.postProcessGeneration(); - this.level.startTickingChunk(chunk); - }); - }, this.mainThreadExecutor); - diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..d251e07eec07f8f822af1f8713e46aebe54b4890 100644 +index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..95feb9e316d4d1115c7dad5873979708f8d647d9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -178,6 +178,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -67,30 +36,26 @@ index 7e3f7b69fc7a608dd82b471d832cc401a77f0738..d251e07eec07f8f822af1f8713e46aeb // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -1008,17 +1009,18 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - return ChunkStatus.FULL; +@@ -1009,16 +1010,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> { -- return either.mapLeft((list) -> { + return either.mapLeft((list) -> { - return (LevelChunk) list.get(list.size() / 2); - }); - }, (runnable) -> { - this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); - }).thenApplyAsync((either) -> { - return either.ifLeft((chunk) -> { -+ // Paper start -+ return either.flatMap((list) -> { -+ LevelChunk chunk = (LevelChunk) list.get(list.size() / 2); ++ // Paper start - revert 1.18.2 diff ++ final LevelChunk chunk = (LevelChunk) list.get(list.size() / 2); chunk.postProcessGeneration(); this.level.startTickingChunk(chunk); -+ return Either.left(chunk); -+ ++ return chunk; }); - }, this.mainThreadExecutor); + }, (runnable) -> { -+ this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. -+ }); -+ // Paper end ++ this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, () -> ChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. ++ }); // Paper end - revert 1.18.2 diff completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { diff --git a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index b07379339e..1ea10446b3 100644 --- a/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0404-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d251e07eec07f8f822af1f8713e46aebe54b4890..c11dac1aa504a9e82d883134caa9b4b689501ce1 100644 +index 95feb9e316d4d1115c7dad5873979708f8d647d9..da40ae8799de108b1d3913c3c27ed4f9273fb303 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1624,6 +1624,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1622,6 +1622,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider .printStackTrace(); return; } diff --git a/patches/server/0430-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0430-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 291f734b76..e2ed8544dc 100644 --- a/patches/server/0430-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0430-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c11dac1aa504a9e82d883134caa9b4b689501ce1..d5e037385263cb094cbbf15823e38e81acafc7d7 100644 +index da40ae8799de108b1d3913c3c27ed4f9273fb303..7f8f242a746d542192bf59fc17e43d3544e5a442 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1902,9 +1902,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1900,9 +1900,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void updatePlayer(ServerPlayer player) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (player != this.entity) { diff --git a/patches/server/0433-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/0433-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 6630f7f50a..a2d751fb31 100644 --- a/patches/server/0433-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/0433-Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -42,7 +42,7 @@ index 674a6492e2eb10cfd29989643eedcea08b2d5218..dff475b327d6edaa4dcb9bc09029237f // Paper start diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d5e037385263cb094cbbf15823e38e81acafc7d7..0959adc5ec64d1939fc212151d5e0df073ebc312 100644 +index 7f8f242a746d542192bf59fc17e43d3544e5a442..80018a94c12b7963c87b3960b71d88d8ac50ff09 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -181,11 +181,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -143,7 +143,7 @@ index d5e037385263cb094cbbf15823e38e81acafc7d7..0959adc5ec64d1939fc212151d5e0df0 this.pendingUnloads.put(j, playerchunk); this.modified = true; this.scheduleUnload(j, playerchunk); // Paper - Move up - don't leak chunks -@@ -1386,43 +1437,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1384,43 +1435,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return this.anyPlayerCloseEnoughForSpawning(pos, false); } diff --git a/patches/server/0434-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/0434-Use-distance-map-to-optimise-entity-tracker.patch index ef37566a54..ef2dfbe246 100644 --- a/patches/server/0434-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/0434-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2f55952fd 100644 +index 80018a94c12b7963c87b3960b71d88d8ac50ff09..2ff9c1f1c41494c282b43eafeb719172f664414b 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -70,6 +70,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -126,7 +126,7 @@ index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2 // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -1560,17 +1638,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1558,17 +1636,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void move(ServerPlayer player) { @@ -145,7 +145,7 @@ index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2 int i = SectionPos.blockToSectionCoord(player.getBlockX()); int j = SectionPos.blockToSectionCoord(player.getBlockZ()); -@@ -1697,7 +1765,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1695,7 +1763,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); @@ -154,7 +154,7 @@ index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -1741,7 +1809,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1739,7 +1807,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = null; // Paper - We're no longer tracked } @@ -192,7 +192,7 @@ index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2 List<ServerPlayer> list = Lists.newArrayList(); List<ServerPlayer> list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -1817,23 +1915,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1815,23 +1913,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); List<Entity> list = Lists.newArrayList(); List<Entity> list1 = Lists.newArrayList(); @@ -236,7 +236,7 @@ index 0959adc5ec64d1939fc212151d5e0df073ebc312..1400975fd7debce564f289bf32d14dc2 Iterator iterator; Entity entity1; -@@ -1909,6 +2015,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1907,6 +2013,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastSectionPos = SectionPos.of(entity); } diff --git a/patches/server/0457-incremental-chunk-and-player-saving.patch b/patches/server/0457-incremental-chunk-and-player-saving.patch index 32a8c94cd7..e49b374458 100644 --- a/patches/server/0457-incremental-chunk-and-player-saving.patch +++ b/patches/server/0457-incremental-chunk-and-player-saving.patch @@ -165,7 +165,7 @@ index dff475b327d6edaa4dcb9bc09029237f8f659846..05d2790b80a6d2e1dc6b8d2375f783be for (int i = 0; i < this.futures.length(); ++i) { CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = (CompletableFuture) this.futures.get(i); diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1400975fd7debce564f289bf32d14dc2f55952fd..644ab527da5107c7cbfc037a143b1afe54efed7b 100644 +index 2ff9c1f1c41494c282b43eafeb719172f664414b..85a05c9e59ae1909e6d4ce7a2e45b16366a1b7dc 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -104,6 +104,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -264,7 +264,7 @@ index 1400975fd7debce564f289bf32d14dc2f55952fd..644ab527da5107c7cbfc037a143b1afe this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.tryScheduleUpdate(); -@@ -1248,6 +1302,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1246,6 +1300,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider asyncSaveData, chunk); chunk.setUnsaved(false); @@ -272,7 +272,7 @@ index 1400975fd7debce564f289bf32d14dc2f55952fd..644ab527da5107c7cbfc037a143b1afe } // Paper end -@@ -1257,6 +1312,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1255,6 +1310,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (!chunk.isUnsaved()) { return false; } else { diff --git a/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch index 5885f67549..0ea9e0770d 100644 --- a/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch +++ b/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch @@ -10,10 +10,10 @@ chunk future to complete. We can simply schedule to the immediate executor to get this effect, rather than the main mailbox. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index fcfb7df39457a539fea4c6b6af17d9d05e6ce812..74623b0f56e64afadb87cb6924159c0f9b79a56c 100644 +index edb35a483ae44073d560df1fe949aad60bf3d39d..fdfac353fe9cf8509a08b5157ed0762c3a12f3e3 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1316,9 +1316,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1314,9 +1314,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return chunk; }); diff --git a/patches/server/0750-Do-not-copy-visible-chunks.patch b/patches/server/0750-Do-not-copy-visible-chunks.patch index b30322d410..fdcf7f41ba 100644 --- a/patches/server/0750-Do-not-copy-visible-chunks.patch +++ b/patches/server/0750-Do-not-copy-visible-chunks.patch @@ -35,7 +35,7 @@ index b3516862d796c2d9fcc1c67a6073445403d73088..b61abf227a04b4565c2525e5f469db30 List<ChunkHolder> allChunks = new ArrayList<>(visibleChunks.values()); List<ServerPlayer> players = world.players; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7aa89874aeb53755fc75f56614568f31110af42a..50a89a1f485611249a1b393ae75b4ff6b9534402 100644 +index 9b2c5fe2389c6baa239de4f7b479d9ca273e59cf..c19395ab43b956787bf0e59ae242ff3a53d4ca46 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -123,9 +123,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -152,7 +152,7 @@ index 7aa89874aeb53755fc75f56614568f31110af42a..50a89a1f485611249a1b393ae75b4ff6 this.modified = false; return true; } -@@ -1481,7 +1493,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1479,7 +1491,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.viewDistance = j; this.distanceManager.updatePlayerTickets(this.viewDistance + 1); @@ -161,7 +161,7 @@ index 7aa89874aeb53755fc75f56614568f31110af42a..50a89a1f485611249a1b393ae75b4ff6 while (objectiterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); -@@ -1524,7 +1536,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1522,7 +1534,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public int size() { @@ -170,7 +170,7 @@ index 7aa89874aeb53755fc75f56614568f31110af42a..50a89a1f485611249a1b393ae75b4ff6 } public DistanceManager getDistanceManager() { -@@ -1532,13 +1544,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1530,13 +1542,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } protected Iterable<ChunkHolder> getChunks() { diff --git a/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch b/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch index aaa352b87b..7ee2e496b9 100644 --- a/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch +++ b/patches/server/0767-Oprimise-map-impl-for-tracked-players.patch @@ -7,7 +7,7 @@ Reference2BooleanOpenHashMap is going to have better lookups than HashMap. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 50a89a1f485611249a1b393ae75b4ff6b9534402..01cb03ab0839aa7e2b9c54226b557306e4115348 100644 +index c19395ab43b956787bf0e59ae242ff3a53d4ca46..af9b1fe737ab430861b4d0de33eec1325964c3a5 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -110,6 +110,7 @@ import org.apache.commons.lang3.mutable.MutableObject; @@ -18,7 +18,7 @@ index 50a89a1f485611249a1b393ae75b4ff6b9534402..01cb03ab0839aa7e2b9c54226b557306 public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider { -@@ -2171,7 +2172,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -2169,7 +2170,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; diff --git a/patches/server/0864-Replace-player-chunk-loader-system.patch b/patches/server/0864-Replace-player-chunk-loader-system.patch index a852acb727..6898d1fd95 100644 --- a/patches/server/0864-Replace-player-chunk-loader-system.patch +++ b/patches/server/0864-Replace-player-chunk-loader-system.patch @@ -1381,7 +1381,7 @@ index 36b6e7295cf7484675c8c2b9624c1f6fea7aed1d..38db3905f47fefb5c958fa24aef2313e public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getOrScheduleFuture(ChunkStatus targetStatus, ChunkMap chunkStorage) { diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc19f707f1 100644 +index a29b97f941eadb1ede5db805d32f2917469cccb9..edc6235288f0843608dae4552e05915e4067cbf2 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -217,6 +217,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1434,7 +1434,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc } // Paper end // Paper start -@@ -1437,11 +1441,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1435,11 +1439,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider completablefuture1.thenAcceptAsync((either) -> { either.ifLeft((chunk) -> { this.tickingGenerated.getAndIncrement(); @@ -1447,7 +1447,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc }); }, (runnable) -> { this.mainThreadMailbox.tell(ChunkTaskPriorityQueueSorter.message(holder, runnable)); -@@ -1610,33 +1610,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1608,33 +1608,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int k = this.viewDistance; this.viewDistance = j; @@ -1490,7 +1490,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc if (chunk != null) { this.playerLoadedChunk(player, packet, chunk); -@@ -1667,7 +1658,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1665,7 +1656,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider void dumpChunks(Writer writer) throws IOException { CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("z").addColumn("level").addColumn("in_memory").addColumn("status").addColumn("full_status").addColumn("accessible_ready").addColumn("ticking_ready").addColumn("entity_ticking_ready").addColumn("ticket").addColumn("spawning").addColumn("block_entity_count").addColumn("ticking_ticket").addColumn("ticking_level").addColumn("block_ticks").addColumn("fluid_ticks").build(writer); @@ -1499,7 +1499,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc ObjectBidirectionalIterator objectbidirectionaliterator = this.updatingChunks.getVisibleMap().clone().long2ObjectEntrySet().fastIterator(); // Paper while (objectbidirectionaliterator.hasNext()) { -@@ -1683,7 +1674,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1681,7 +1672,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // CraftBukkit - decompile error csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(ChunkAccess::getStatus).orElse(null), optional1.map(LevelChunk::getFullStatus).orElse(null), ChunkMap.printFuture(playerchunk.getFullChunkFuture()), ChunkMap.printFuture(playerchunk.getTickingChunkFuture()), ChunkMap.printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> { return chunk.getBlockEntities().size(); @@ -1508,7 +1508,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc return chunk.getBlockTicks().count(); }).orElse(0), optional1.map((chunk) -> { return chunk.getFluidTicks().count(); -@@ -1900,15 +1891,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1898,15 +1889,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.removePlayerFromDistanceMaps(player); // Paper - distance maps } @@ -1525,7 +1525,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc } -@@ -1916,7 +1899,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1914,7 +1897,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider SectionPos sectionposition = SectionPos.of((Entity) player); player.setLastSectionPos(sectionposition); @@ -1534,7 +1534,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc return sectionposition; } -@@ -1961,65 +1944,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1959,65 +1942,40 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider int k1; int l1; @@ -1622,7 +1622,7 @@ index 81442caecba8c85ab5af96d712841615b7b7a5dd..42056c7a506a7edfe8a5feabacece5bc } public void addEntity(Entity entity) { -@@ -2388,7 +2346,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -2386,7 +2344,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider double vec3d_dx = player.getX() - this.entity.getX(); double vec3d_dz = player.getZ() - this.entity.getZ(); // Paper end - remove allocation of Vec3D here |