aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch')
-rw-r--r--patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch b/patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch
new file mode 100644
index 0000000000..88b000fa9f
--- /dev/null
+++ b/patches/server/0158-Fix-MC-117075-Block-entity-unload-lag-spike.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: mezz <[email protected]>
+Date: Wed, 9 Aug 2017 17:51:22 -0500
+Subject: [PATCH] Fix MC-117075: Block entity unload lag spike
+
+
+diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
+index 4fcbea7b8b12be10157da0c1f35c06e47c0334ad..ab511f4c056f07aa79aab7b662073bb8db4b1526 100644
+--- a/src/main/java/net/minecraft/world/level/Level.java
++++ b/src/main/java/net/minecraft/world/level/Level.java
+@@ -726,6 +726,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+ boolean flag = this.tickRateManager().runsNormally();
+
+ int tilesThisCycle = 0;
++ var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
++ toRemove.add(null); // Paper - Fix MC-117075
+ for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
+ this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
+ TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
+@@ -734,12 +736,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+ if (tickingblockentity.isRemoved()) {
+ // Spigot start
+ tilesThisCycle--;
+- this.blockEntityTickers.remove(this.tileTickPosition--);
++ toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
+ // Spigot end
+ } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
+ tickingblockentity.tick();
+ }
+ }
++ this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
+
+ this.timings.tileEntityTick.stopTiming(); // Spigot
+ this.tickingBlockEntities = false;