mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-30 20:29:10 +00:00
54 lines
2.4 KiB
Diff
54 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
|
Date: Wed, 26 Mar 2025 01:46:49 +0300
|
|
Subject: [PATCH] Leaf: Improve BlockEntity ticking isRemoved check
|
|
|
|
Original project: https://github.com/Winds-Studio/Leaf
|
|
|
|
This should help for massive hopper chains or hopper matrix.
|
|
|
|
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index 6d9274f0da9507d0152611d6b7785e0524dedb2d..a2b21970841a0f7f2b4b469c7b8737440041ebaa 100644
|
|
--- a/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -982,13 +982,26 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
|
|
public static class RebindableTickingBlockEntityWrapper implements TickingBlockEntity {
|
|
public TickingBlockEntity ticker;
|
|
+ private @Nullable BlockEntity blockEntityReference = null; // DivineMC - Improve BlockEntity ticking isRemoved check
|
|
|
|
RebindableTickingBlockEntityWrapper(TickingBlockEntity ticker) {
|
|
this.ticker = ticker;
|
|
+ // DivineMC start - Improve BlockEntity ticking isRemoved check
|
|
+ if (ticker instanceof BoundTickingBlockEntity<?> boundTicker) {
|
|
+ blockEntityReference = boundTicker.blockEntity;
|
|
+ }
|
|
+ // DivineMC end - Improve BlockEntity ticking isRemoved check
|
|
}
|
|
|
|
public void rebind(TickingBlockEntity ticker) {
|
|
this.ticker = ticker;
|
|
+ // DivineMC start - Improve BlockEntity ticking isRemoved check
|
|
+ if (ticker instanceof BoundTickingBlockEntity<?> boundTicker) {
|
|
+ blockEntityReference = boundTicker.blockEntity;
|
|
+ } else {
|
|
+ blockEntityReference = null;
|
|
+ }
|
|
+ // DivineMC end - Improve BlockEntity ticking isRemoved check
|
|
}
|
|
|
|
@Override
|
|
@@ -998,6 +1011,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
|
|
@Override
|
|
public boolean isRemoved() {
|
|
+ // DivineMC start - Improve BlockEntity ticking isRemoved check
|
|
+ if (blockEntityReference != null) {
|
|
+ return blockEntityReference.isRemoved();
|
|
+ }
|
|
+ // DivineMC end - Improve BlockEntity ticking isRemoved check
|
|
+
|
|
return this.ticker.isRemoved();
|
|
}
|
|
|