summaryrefslogtreecommitdiffstats
path: root/nms-patches/PlayerChunk.patch
blob: 14c175537d5746038285f662ea023e6346e5f2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- a/net/minecraft/server/PlayerChunk.java
+++ b/net/minecraft/server/PlayerChunk.java
@@ -7,21 +7,36 @@
 import javax.annotation.Nullable;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
+// CraftBukkit Start
+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor;
+// CraftBukkit end
 
 public class PlayerChunk {
 
     private static final Logger a = LogManager.getLogger();
     private final PlayerChunkMap playerChunkMap;
-    private final List<EntityPlayer> c = Lists.newArrayList();
+    public final List<EntityPlayer> c = Lists.newArrayList(); // CraftBukkit - public
     private final ChunkCoordIntPair location;
     private final short[] dirtyBlocks = new short[64];
     @Nullable
-    private Chunk chunk;
+    public Chunk chunk; // CraftBukkit - public
     private int dirtyCount;
     private int h;
     private long i;
     private boolean done;
 
+    // CraftBukkit start - add fields
+    // You know the drill, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse
+    // All may seem good at first, but there's deeper issues if you play for a bit
+    private boolean loadInProgress = false;
+    private Runnable loadedRunnable = new Runnable() {
+        public void run() {
+            loadInProgress = false;
+            PlayerChunk.this.chunk = PlayerChunk.this.playerChunkMap.getWorld().getChunkProviderServer().getChunkAt(location.x, location.z, true, true);
+        }
+    };
+    // CraftBukkit end
+
     public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
         this.playerChunkMap = playerchunkmap;
         this.location = new ChunkCoordIntPair(i, j);