From b166af8801988c2e8369aa84a0cf8c2eda542848 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 16 Jul 2021 09:18:04 -0700 Subject: [PATCH] Fix PaperTickList (#6191) --- .../Optimise-TickListServer-by-rewriting-it.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/server/Optimise-TickListServer-by-rewriting-it.patch b/patches/server/Optimise-TickListServer-by-rewriting-it.patch index e0462c29a9..179b3f2203 100644 --- a/patches/server/Optimise-TickListServer-by-rewriting-it.patch +++ b/patches/server/Optimise-TickListServer-by-rewriting-it.patch @@ -168,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private void queueEntryForTick(final TickNextTickData entry, final ServerChunkCache chunkProvider) { + if (entry.tickState == STATE_SCHEDULED) { -+ if (chunkProvider.isTickingReadyMainThread(entry.pos)) { ++ if (chunkProvider.isPositionTickingWithEntitiesLoaded(entry.pos)) { + this.toTickThisTick.add(entry); + entry.tickState = STATE_PENDING_TICK; + } else { @@ -368,7 +368,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + continue; + } + try { -+ if (chunkProvider.isTickingReadyMainThread(toTick.pos)) { ++ if (chunkProvider.isPositionTickingWithEntitiesLoaded(toTick.pos)) { + toTick.tickState = STATE_TICKING; + this.tickFunction.accept(toTick); + if (toTick.tickState == STATE_TICKING) { @@ -932,9 +932,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end + // Paper start - rewrite ticklistserver -+ public final boolean isTickingReadyMainThread(BlockPos pos) { -+ ChunkHolder chunk = this.chunkMap.getUpdatingChunkIfPresent(net.minecraft.server.MCUtil.getCoordinateKey(pos)); -+ return chunk != null && chunk.isTickingReady(); ++ public final boolean isPositionTickingWithEntitiesLoaded(BlockPos pos) { ++ long position = net.minecraft.server.MCUtil.getCoordinateKey(pos); ++ ChunkHolder chunkHolder = this.chunkMap.getUpdatingChunkIfPresent(position); ++ return chunkHolder != null && chunkHolder.isTickingReady() && this.level.entityManager.areEntitiesLoaded(position); + } + // Paper end - rewrite ticklistserver