Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
cc6fd371b2
Fixes #6357 Closes #6508 Closes #6358
43 Zeilen
2.4 KiB
Diff
43 Zeilen
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: mezz <tehgeek@gmail.com>
|
|
Date: Wed, 9 Aug 2017 17:51:22 -0500
|
|
Subject: [PATCH] Fix MC-117075: TE 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 d6e6b5a29ddf980e179471059372dfda8e0d7b1b..62d7c9056c0836b53804e84cc1464cd50380d392 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -728,6 +728,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
// Spigot start
|
|
// Iterator iterator = this.blockEntityTickers.iterator();
|
|
int tilesThisCycle = 0;
|
|
+ var toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet<TickingBlockEntity>(net.minecraft.Util.identityStrategy()); // Paper - use removeAll
|
|
+ toRemove.add(null);
|
|
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(tileTickPosition);
|
|
@@ -735,7 +737,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
if (tickingblockentity == null) {
|
|
this.getCraftServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
|
|
tilesThisCycle--;
|
|
- this.blockEntityTickers.remove(this.tileTickPosition--);
|
|
continue;
|
|
}
|
|
// Spigot end
|
|
@@ -743,12 +744,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
if (tickingblockentity.isRemoved()) {
|
|
// Spigot start
|
|
tilesThisCycle--;
|
|
- this.blockEntityTickers.remove(this.tileTickPosition--);
|
|
+ toRemove.add(tickingblockentity); // Paper - use removeAll
|
|
// Spigot end
|
|
} else {
|
|
tickingblockentity.tick();
|
|
}
|
|
}
|
|
+ this.blockEntityTickers.removeAll(toRemove);
|
|
|
|
timings.tileEntityTick.stopTiming(); // Spigot
|
|
this.tickingBlockEntities = false;
|