From 9844a7a51f2b5053c0c0571bc5b8b09bca98a3d0 Mon Sep 17 00:00:00 2001 From: Samsuik Date: Sat, 15 Mar 2025 16:12:10 +0000 Subject: [PATCH] Only listen for changes when blocks actually change --- ...-Track-block-changes-and-level-tick-scheduler.patch | 10 +++++++--- .../features/0024-Optimise-hopper-ticking.patch | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch index 02a9782..87273b6 100644 --- a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch +++ b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch @@ -32,7 +32,7 @@ index 316dca7b4b20c6d05bf76f64a79984d10807dab5..9fbce0f31a73928a7db752e085fb3d00 protected Level( WritableLevelData levelData, diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 761fdcd4a4e18f45547afd8edff44f61c6eeacb4..2fb04fa82cc7b726df1e42a1cf452ebfbdd4503a 100644 +index 761fdcd4a4e18f45547afd8edff44f61c6eeacb4..f8b5c74403ebf936bbac20d68a2dfa7b0aca9cfc 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -126,6 +126,21 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -65,11 +65,15 @@ index 761fdcd4a4e18f45547afd8edff44f61c6eeacb4..2fb04fa82cc7b726df1e42a1cf452ebf } public LevelChunk(ServerLevel level, ProtoChunk chunk, @Nullable LevelChunk.PostLoadProcessor postLoad) { -@@ -404,6 +420,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -404,6 +420,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p if (!section.getBlockState(i, i1, i2).is(block)) { return null; } else { -+ this.blockChange(pos, state, blockState); // Sakura - track block changes and tick scheduler ++ // Sakura start - track block changes and tick scheduler ++ if (state.getBlock() != blockState.getBlock()) { ++ this.blockChange(pos, state, blockState); ++ } ++ // Sakura end - track block changes and tick scheduler if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. state.onPlace(this.level, pos, blockState, isMoving); } diff --git a/sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch b/sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch index 3bb4a9e..3c32ead 100644 --- a/sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch +++ b/sakura-server/minecraft-patches/features/0024-Optimise-hopper-ticking.patch @@ -287,10 +287,10 @@ index 28e3b73507b988f7234cbf29c4024c88180d0aef..a0d247aa883553708c4b921582324255 + // Sakura end - optimise hopper ticking } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 2fb04fa82cc7b726df1e42a1cf452ebfbdd4503a..e2b684c630a44d7f84790ad305593823edb241ca 100644 +index f8b5c74403ebf936bbac20d68a2dfa7b0aca9cfc..b9391bae49ee0b3997ea2dfa19e82624ba1595f0 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -972,6 +972,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -976,6 +976,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return BlockEntityType.getKey(this.blockEntity.getType()).toString(); } @@ -304,7 +304,7 @@ index 2fb04fa82cc7b726df1e42a1cf452ebfbdd4503a..e2b684c630a44d7f84790ad305593823 @Override public String toString() { return "Level ticker for " + this.getType() + "@" + this.getPos(); -@@ -1020,6 +1027,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1024,6 +1031,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return this.ticker.getType(); }