unmark chunk as unloading when unload is cancelled

no obviousy bugs caused by this at the moment, but we may need to clean up process to be like
how I use to have it before vanilla did it, and we shouldn't leave this boolean in an invalid state.
This commit is contained in:
Aikar 2016-05-12 02:07:39 -04:00
parent 8e57fdd12b
commit dba25d1e86

View File

@ -0,0 +1,34 @@
From d2cbd64700e4bd54a1aec471f69977b63c6ea2ec Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 02:03:56 -0400
Subject: [PATCH] Unmark chunk as unloading when unload is cancelled
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 4953e97..1981ae4 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -46,7 +46,7 @@ public class Chunk {
private long w;
private int x;
private ConcurrentLinkedQueue<BlockPosition> y;
- public boolean d;
+ public boolean d;public void setShouldUnload(boolean unload) { this.d = unload; } // Paper // OBFHELPER
protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
public int lightUpdates; // Paper - Number of queued light updates for this chunk
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 694f3d5..f67dbae 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = (Chunk) this.chunks.get(olong);
if (chunk != null && chunk.d) {
+ chunk.setShouldUnload(false); // Paper
if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates.
// CraftBukkit start
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
--
2.8.2