You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leaf-server/minecraft-patches/features/0194-PaperPR-Fix-MC-117075-Block-Entities-Unload-Lag-Spik.patch
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,15 @@ We replaced the `blockEntityTickers` list with a custom list based on fastutil's
12
12
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).
index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e4f4d6bd2 100644
15
+
index f145453f70a219c1be33b241309ae2ab22a8004b..d56464dc0cb5efaeaf285c11b88fe8d7e2333b36 100644
16
16
--- a/net/minecraft/world/level/Level.java
17
17
+++ b/net/minecraft/world/level/Level.java
18
18
@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
19
19
public static final int TICKS_PER_DAY = 24000;
20
20
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
21
21
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
22
22
- 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
24
24
protected final NeighborUpdater neighborUpdater;
25
25
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
26
26
private boolean tickingBlockEntities;
@@ -35,7 +35,7 @@ index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e
35
35
// Spigot end
36
36
if (tickingBlockEntity.isRemoved()) {
37
37
- 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
39
39
} else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) {
40
40
tickingBlockEntity.tick();
41
41
// Paper start - rewrite chunk system
@@ -44,7 +44,7 @@ index f145453f70a219c1be33b241309ae2ab22a8004b..22da84734462d09a55bc599db4374e1e
44
44
}
45
45
}
46
46
- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
0 commit comments