2014-03-23 00:06:43 +00:00
|
|
|
From e35b3899f68a3f8d2563a5c31d4d4370d57c0e54 Mon Sep 17 00:00:00 2001
|
2013-01-19 08:22:07 +00:00
|
|
|
From: Mike Primm <mike@primmhome.com>
|
|
|
|
Date: Wed, 16 Jan 2013 15:27:22 -0600
|
2013-06-11 04:11:48 +00:00
|
|
|
Subject: [PATCH] Sync Free Chunk Reference Cache
|
2013-01-19 08:22:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2014-03-23 00:06:43 +00:00
|
|
|
index 1ed1e27..d2679dc 100644
|
2013-01-19 08:22:07 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2014-03-23 00:06:43 +00:00
|
|
|
@@ -291,20 +291,18 @@ public abstract class World implements IBlockAccess {
|
2013-12-01 03:40:53 +00:00
|
|
|
return this.getChunkAt(i >> 4, j >> 4);
|
|
|
|
}
|
2013-01-19 08:22:07 +00:00
|
|
|
|
2013-12-01 03:40:53 +00:00
|
|
|
+ // Spigot start
|
2013-01-19 08:22:07 +00:00
|
|
|
public Chunk getChunkAt(int i, int j) {
|
2013-12-01 03:40:53 +00:00
|
|
|
- // CraftBukkit start
|
2013-01-19 08:22:07 +00:00
|
|
|
- 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
|
2013-12-01 04:36:32 +00:00
|
|
|
+ if (result == null || result.locX != i || result.locZ != j) {
|
2013-01-19 08:22:07 +00:00
|
|
|
+ result = this.chunkProvider.getOrCreateChunk(i, j);
|
|
|
|
+ this.lastChunkAccessed = result; // Exploit fact that write is atomic
|
|
|
|
}
|
|
|
|
+ //}
|
|
|
|
return result;
|
2013-12-01 03:40:53 +00:00
|
|
|
- // CraftBukkit end
|
2013-01-19 08:22:07 +00:00
|
|
|
}
|
2013-12-01 03:40:53 +00:00
|
|
|
+ // Spigot end
|
|
|
|
|
|
|
|
public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) {
|
|
|
|
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
|
2013-01-19 08:22:07 +00:00
|
|
|
--
|
2014-03-23 00:06:43 +00:00
|
|
|
1.8.5.2.msysgit.0
|
2013-01-19 08:22:07 +00:00
|
|
|
|