2013-07-11 03:31:30 +02:00
|
|
|
From c876ff9dabc9bf638b9fcb1fd21521904c87193a Mon Sep 17 00:00:00 2001
|
2013-01-19 09:22:07 +01:00
|
|
|
From: Mike Primm <mike@primmhome.com>
|
|
|
|
Date: Wed, 16 Jan 2013 15:27:22 -0600
|
2013-06-11 06:11:48 +02:00
|
|
|
Subject: [PATCH] Sync Free Chunk Reference Cache
|
2013-01-19 09:22:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2013-07-11 03:31:30 +02:00
|
|
|
index 4ec4d08..d5552b6 100644
|
2013-01-19 09:22:07 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2013-07-02 05:03:56 +02:00
|
|
|
@@ -300,15 +300,13 @@ public abstract class World implements IBlockAccess {
|
2013-01-19 09:22:07 +01:00
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
public Chunk getChunkAt(int i, int j) {
|
|
|
|
- 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;
|
|
|
|
+ //synchronized (this.chunkLock) {
|
|
|
|
+ Chunk result = this.lastChunkAccessed; // Exploit fact that read is atomic
|
|
|
|
+ if (result == null || result.x != i || result.z != j) {
|
|
|
|
+ result = this.chunkProvider.getOrCreateChunk(i, j);
|
|
|
|
+ this.lastChunkAccessed = result; // Exploit fact that write is atomic
|
|
|
|
}
|
|
|
|
+ //}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
--
|
2013-06-02 07:15:15 +02:00
|
|
|
1.8.1.2
|
2013-01-19 09:22:07 +01:00
|
|
|
|