9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-19 14:59:30 +00:00

Only listen for changes when blocks actually change

This commit is contained in:
Samsuik
2025-03-15 16:12:10 +00:00
parent 5e7c365ce6
commit 9844a7a51f
2 changed files with 10 additions and 6 deletions

View File

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

View File

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