Fix Entity#isTicking and update Paper entity command (#11590)

fixes #10299
This commit is contained in:
Jason Penilla 2024-11-09 07:41:26 -07:00
parent 02cdc61bbc
commit 13a6161350
5 changed files with 4 additions and 21 deletions

View file

@ -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);
}
});

View file

@ -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
}

View file

@ -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

View file

@ -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;

View file

@ -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);
+ }
+ });