From 9f70c1f3864632b90a4c4edfbde7f6fc2c10b9b0 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Thu, 20 Sep 2012 23:00:34 -0500 Subject: [PATCH] Set last accessed variables after grabbing chunk. Fixes BUKKIT-1033 This fix changes the 'state' of the last accessed variables to be more accurate. Changing the coordinates of the last accessed chunk should never precede actually setting the last accessed chunk, as loading a chunk may at some point call back to getChunkAt with a new set of coordinates before the chunk has actually been loaded. The coordinates would have been set, but the actual chunk would not. With no check for accuracy, this causes fringe case issues such as null block states. Big thanks to @V10lator for finding where the root of the problem was occurring. --- src/main/java/net/minecraft/server/World.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 7b97740c12..da8fffd47d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -223,9 +223,9 @@ public abstract class World implements IBlockAccess { Chunk result = null; synchronized (this.chunkLock) { if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) { + this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j); this.lastXAccessed = i; this.lastZAccessed = j; - this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j); } result = this.lastChunkAccessed; }