From 13a6161350cf0f12954f256c1aa5e0c026280d87 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sat, 9 Nov 2024 07:41:26 -0700 Subject: [PATCH] Fix Entity#isTicking and update Paper entity command (#11590) fixes #10299 --- patches/server/Don-t-tick-markers.patch | 4 ++-- patches/server/Entity-isTicking.patch | 2 +- patches/server/MC-Utils.patch | 13 ------------- patches/server/Moonrise-optimisation-patches.patch | 4 ---- patches/server/Paper-command.patch | 2 +- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/patches/server/Don-t-tick-markers.patch b/patches/server/Don-t-tick-markers.patch index 866926d5d1..d02a2ad4d4 100644 --- a/patches/server/Don-t-tick-markers.patch +++ b/patches/server/Don-t-tick-markers.patch @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ChunkPos chunk = e.chunkPosition(); info.left++; info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); -- if (!chunkProviderServer.isPositionTicking(e)) { -+ if (!chunkProviderServer.isPositionTicking(e) || (e instanceof net.minecraft.world.entity.Marker && !world.paperConfig().entities.markers.tick)) { // Paper - Configurable marker ticking +- if (!world.isPositionEntityTicking(e.blockPosition())) { ++ if (!world.isPositionEntityTicking(e.blockPosition()) || (e instanceof net.minecraft.world.entity.Marker && !world.paperConfig().entities.markers.tick)) { // Paper - Configurable marker ticking nonEntityTicking.merge(key, 1, Integer::sum); } }); diff --git a/patches/server/Entity-isTicking.patch b/patches/server/Entity-isTicking.patch index 906b1f253a..a79337dcc4 100644 --- a/patches/server/Entity-isTicking.patch +++ b/patches/server/Entity-isTicking.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + + public boolean isTicking() { -+ return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this); ++ return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition()); + } // Paper end - Expose entity id counter } diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index a24b9c999f..196d614376 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -5422,19 +5422,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.distanceManager.runAllUpdates(this.chunkMap); boolean flag1 = this.chunkMap.promoteChunkMap(); -@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { - } - } - -+ // Paper start -+ public boolean isPositionTicking(Entity entity) { -+ return this.isPositionTicking(ChunkPos.asLong(net.minecraft.util.Mth.floor(entity.getX()) >> 4, net.minecraft.util.Mth.floor(entity.getZ()) >> 4)); -+ } -+ // Paper end -+ - public boolean isPositionTicking(long pos) { - if (!this.level.shouldTickBlocksAt(pos)) { - return false; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/patches/server/Moonrise-optimisation-patches.patch b/patches/server/Moonrise-optimisation-patches.patch index 0a98f178fc..182d3fdd96 100644 --- a/patches/server/Moonrise-optimisation-patches.patch +++ b/patches/server/Moonrise-optimisation-patches.patch @@ -26597,10 +26597,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.processTicketUpdates(); // Paper - rewrite chunk system } - // Paper start -@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { - // Paper end - public boolean isPositionTicking(long pos) { - if (!this.level.shouldTickBlocksAt(pos)) { - return false; diff --git a/patches/server/Paper-command.patch b/patches/server/Paper-command.patch index aeb9335d10..49e0e8b873 100644 --- a/patches/server/Paper-command.patch +++ b/patches/server/Paper-command.patch @@ -447,7 +447,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ChunkPos chunk = e.chunkPosition(); + info.left++; + info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1); -+ if (!chunkProviderServer.isPositionTicking(e)) { ++ if (!world.isPositionEntityTicking(e.blockPosition())) { + nonEntityTicking.merge(key, 1, Integer::sum); + } + });