PaperMC/nms-patches/PlayerChunk.patch
2018-07-15 10:00:00 +10:00

41 lines
1.6 KiB
Diff

--- 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().getOrLoadChunkAt(location.x, location.z);
+ }
+ };
+ // CraftBukkit end
+
public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) {
this.playerChunkMap = playerchunkmap;
this.location = new ChunkCoordIntPair(i, j);