9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-22 16:39:33 +00:00
Files
SparklyPaperMC/patches/server/0014-Revert-Fix-MC-117075-Block-entity-unload-lag-spike.patch

38 lines
2.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
Date: Sun, 18 Feb 2024 14:22:37 -0300
Subject: [PATCH] Revert "Fix MC-117075: Block entity unload lag spike"
This reverts commit f3453b204569ea865cc1d1302edb6d125e7f0cb3.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a246c6781a16d0cf9097a0589b1287110750a258..d75c9d7766ca1f85821abb8caade5e71be17b51c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1285,8 +1285,6 @@ 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);
@@ -1295,7 +1293,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (tickingblockentity.isRemoved()) {
// Spigot start
tilesThisCycle--;
- toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
+ this.blockEntityTickers.remove(this.tileTickPosition--);
// Spigot end
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick();
@@ -1306,7 +1304,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end - execute chunk tasks during tick
}
}
- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false;