1358d1e914
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 881e06e5 PR-725: Add Item Unlimited Lifetime APIs CraftBukkit Changes: 74c08312 SPIGOT-6962: Call EntityChangeBlockEvent when when FallingBlockEntity starts to fall 64db5126 SPIGOT-6959: Make /loot command ignore empty items for spawn 2d760831 Increase outdated build delay 9ed7e4fb SPIGOT-6138, SPIGOT-6415: Don't call CreatureSpawnEvent after cross-dimensional travel fc4ad813 SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 59733a2e SPIGOT-6961: Actually return a copy of the ItemMeta Spigot Changes: ffceeae3 SPIGOT-6956: Drop unload queue patch as attempt at fixing stop issue e19ddabd PR-1011: Add Item Unlimited Lifetime APIs 34d40b0e SPIGOT-2942: give command fires PlayerDropItemEvent, cancelling it causes Item Duplication
63 Zeilen
4.3 KiB
Diff
63 Zeilen
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <spottedleaf@spottedleaf.dev>
|
|
Date: Sat, 19 Sep 2020 15:29:16 -0700
|
|
Subject: [PATCH] Do not allow ticket level changes while unloading
|
|
playerchunks
|
|
|
|
Sync loading the chunk at this stage would cause it to load
|
|
older data, as well as screwing our region state.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
index 971a31641ec33a80f45e507944fa4cd90bfc466a..5d60fa26e9f5d3c9c57a61c509d5b924bbed3281 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
@@ -313,6 +313,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
}
|
|
// Paper end
|
|
|
|
+ boolean unloadingPlayerChunk = false; // Paper - do not allow ticket level changes while unloading chunks
|
|
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
|
|
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
|
|
this.visibleChunkMap = this.updatingChunkMap.clone();
|
|
@@ -707,6 +708,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
|
|
@Nullable
|
|
ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k) {
|
|
+ if (this.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.error("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper
|
|
if (k > ChunkMap.MAX_CHUNK_DISTANCE && level > ChunkMap.MAX_CHUNK_DISTANCE) {
|
|
return holder;
|
|
} else {
|
|
@@ -910,6 +912,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
if (completablefuture1 != completablefuture) {
|
|
this.scheduleUnload(pos, holder);
|
|
} else {
|
|
+ // Paper start - do not allow ticket level changes while unloading chunks
|
|
+ org.spigotmc.AsyncCatcher.catchOp("playerchunk unload");
|
|
+ boolean unloadingBefore = this.unloadingPlayerChunk;
|
|
+ this.unloadingPlayerChunk = true;
|
|
+ try {
|
|
+ // Paper end - do not allow ticket level changes while unloading chunks
|
|
// Paper start
|
|
boolean removed;
|
|
if ((removed = this.pendingUnloads.remove(pos, holder)) && ichunkaccess != null) {
|
|
@@ -947,6 +955,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
this.regionManagers.get(index).removeChunk(holder.pos.x, holder.pos.z);
|
|
}
|
|
} // Paper end
|
|
+ } finally { this.unloadingPlayerChunk = unloadingBefore; } // Paper - do not allow ticket level changes while unloading chunks
|
|
|
|
}
|
|
};
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
index c97692440f4f0403714cdd7d1fba5496e324b40c..718c89f421637d623a92e5167397870562593a04 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
@@ -816,6 +816,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
|
|
public boolean runDistanceManagerUpdates() {
|
|
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority
|
|
+ if (this.chunkMap.unloadingPlayerChunk) { LOGGER.error("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper
|
|
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
|
|
boolean flag1 = this.chunkMap.promoteChunkMap();
|
|
|