3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

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.
Dieser Commit ist enthalten in:
Wesley Wolfe 2012-09-20 23:00:34 -05:00
Ursprung cebc8cffec
Commit 9f70c1f386

Datei anzeigen

@ -223,9 +223,9 @@ public abstract class World implements IBlockAccess {
Chunk result = null; Chunk result = null;
synchronized (this.chunkLock) { synchronized (this.chunkLock) {
if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) { if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) {
this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
this.lastXAccessed = i; this.lastXAccessed = i;
this.lastZAccessed = j; this.lastZAccessed = j;
this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
} }
result = this.lastChunkAccessed; result = this.lastChunkAccessed;
} }