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

Removing broken chunk caching from World. Fixes BUKKIT-5425

Chunk caching in the World class does not know about outdated cache values.
This caused various problems when accessing previously unloaded chunks. The
caching also did not improve the performance so it is removed.
Synchronization is also not necessary, because all accesses to getChunkAt
may only come from the main thread.
Dieser Commit ist enthalten in:
Brokkonaut 2014-02-20 02:20:32 +01:00 committet von Travis Watkins
Ursprung 890a4af12f
Commit 0092460086

Datei anzeigen

@ -103,10 +103,6 @@ public abstract class World implements IBlockAccess {
public boolean pvpMode;
public boolean keepSpawnInMemory = true;
public ChunkGenerator generator;
Chunk lastChunkAccessed;
int lastXAccessed = Integer.MIN_VALUE;
int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object();
public CraftWorld getWorld() {
return this.world;
@ -262,18 +258,7 @@ public abstract class World implements IBlockAccess {
}
public Chunk getChunkAt(int i, int j) {
// CraftBukkit start
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;
}
result = this.lastChunkAccessed;
}
return result;
// CraftBukkit end
return this.chunkProvider.getOrCreateChunk(i, j);
}
public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) {