From 0092460086aaa09879ac33195b32229dc9476eb0 Mon Sep 17 00:00:00 2001 From: Brokkonaut Date: Thu, 20 Feb 2014 02:20:32 +0100 Subject: 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. --- src/main/java/net/minecraft/server/World.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/main/java/net/minecraft') diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0f97f78a..e6bb1d5f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -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) { -- cgit v1.2.3