Execute mid tick tasks during tile entity ticking

It was never done here in the past since the old TE management
system was barely functional, and could not handle chunk loading
remotely well
This commit is contained in:
Spottedleaf 2022-02-22 14:42:00 -08:00
parent 854f3d35c1
commit db811631ae
2 changed files with 17 additions and 5 deletions

View File

@ -159,10 +159,22 @@ index 3c2c326c974531eda95757893981a28fb52b4d16..d932a4d0688cccac8cf7418bf2eaaa40
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c603dcbe89a49e9e7de7fbc5c863e4b3a9869f95..1a76c8a52926bf15f55640d5c053a7235c58d3ed 100644
index c603dcbe89a49e9e7de7fbc5c863e4b3a9869f95..d151886adf3292d105d1031e4784ecea25a43dd3 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -895,6 +895,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -881,6 +881,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end
} else if (this.shouldTickBlocksAt(ChunkPos.asLong(tickingblockentity.getPos()))) {
tickingblockentity.tick();
+ // Paper start - execute chunk tasks during tick
+ if ((this.tileTickPosition & 7) == 0) {
+ MinecraftServer.getServer().executeMidTickTasks();
+ }
+ // Paper end - execute chunk tasks during tick
}
}
this.blockEntityTickers.removeAll(toRemove);
@@ -895,6 +900,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
try {
tickConsumer.accept(entity);

View File

@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..e8b4053babe46999980b926431254050
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3735b80c6f827500a9c474d4139d6e748b14863b..fe2e5eb72307f8f07987b12a1af9100348b86a82 100644
index 8b37f9048495f0da85b811caf4d26930b334edb9..9e252fcb7f08d801cf5700234ae6414ce9dc6dca 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -642,6 +642,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -297,10 +297,10 @@ index 60e1111f3c2c43398f21c541248f38524f41f4fb..56e9c0d15249562ebea8eb451d4bcc9f
public BlockPos getHomePos() {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f0eb297e0a894864de4e4198396edcbef9ae191e..742d4645a6d22d10bc2833e3b742a6bc653d473d 100644
index 6b23c2a62d13cfda7036c1ae8bcbda4b62032834..a3977a94a8fbc633c56e2b043f259464deac6413 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1354,10 +1354,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1359,10 +1359,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract TagContainer getTagManager();
public BlockPos getBlockRandomPos(int x, int y, int z, int l) {