Skip to content

Commit a1a3480

Browse files
committed
Update changes from ver/1.21.4 branch
2 parents 34d9673 + e7c221e commit a1a3480

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

leaf-server/minecraft-patches/features/0194-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ We replaced the `blockEntityTickers` list with a custom list based on fastutil's
1212
This is WAY FASTER than using `removeAll` with a list of entries to be removed, because we don't need to calculate the identity of each block entity to be removed, and we can jump directly to where the search should begin, giving a performance boost for small removals (because we don't need to loop thru the entire list to find what element should be removed) and a performance boost for big removals (no need to calculate the identity of each block entity).
1313

1414
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
15-
index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e4f4d6bd2 100644
15+
index f145453f70a219c1be33b241309ae2ab22a8004b..d56464dc0cb5efaeaf285c11b88fe8d7e2333b36 100644
1616
--- a/net/minecraft/world/level/Level.java
1717
+++ b/net/minecraft/world/level/Level.java
1818
@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
1919
public static final int TICKS_PER_DAY = 24000;
2020
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
2121
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
2222
- public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList();
23-
+ public final org.dreeam.leaf.util.list.BlockEntityTickersList blockEntityTickers = new org.dreeam.leaf.util.list.BlockEntityTickersList(); // SparklyPaper - optimize block entity removals
23+
+ public final List<TickingBlockEntity> blockEntityTickers = new org.dreeam.leaf.util.list.BlockEntityTickersList(); // Paper - public // SparklyPaper - optimize block entity removals
2424
protected final NeighborUpdater neighborUpdater;
2525
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
2626
private boolean tickingBlockEntities;
@@ -35,7 +35,7 @@ index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e
3535
// Spigot end
3636
if (tickingBlockEntity.isRemoved()) {
3737
- toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll
38-
+ this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll // SparklyPaper - optimize block entity removals
38+
+ ((org.dreeam.leaf.util.list.BlockEntityTickersList) this.blockEntityTickers).markAsRemoved(this.tileTickPosition); // toRemove.add(tickingBlockEntity); // SparklyPaper - optimize block entity removals // Paper - Fix MC-117075; use removeAll
3939
} else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) {
4040
tickingBlockEntity.tick();
4141
// Paper start - rewrite chunk system
@@ -44,7 +44,7 @@ index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e
4444
}
4545
}
4646
- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
47-
+ this.blockEntityTickers.removeMarkedEntries(); // SparklyPaper - optimize block entity removals
47+
+ ((org.dreeam.leaf.util.list.BlockEntityTickersList) this.blockEntityTickers).removeMarkedEntries(); // SparklyPaper - optimize block entity removals
4848

4949
this.tickingBlockEntities = false;
5050
this.spigotConfig.currentPrimedTnt = 0; // Spigot

0 commit comments

Comments
 (0)