mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix chunk unload issues - Resolves #97
This commit is contained in:
parent
bb82a8a401
commit
7efe31a331
1 changed files with 55 additions and 0 deletions
|
@ -71,6 +71,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return getChunkAt(x, z); // Paper
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public Chunk getLoadedChunkAtWithoutMarkingActive(int i, int j) {
|
||||
+ return chunks.get(LongHash.toLong(i, j));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Chunk getChunkIfLoaded(int x, int z) {
|
||||
- return chunks.get(LongHash.toLong(x, z));
|
||||
+ return getLoadedChunkAt(x, z); // Paper - Bukkit has a duplicate method now.
|
||||
|
@ -92,6 +98,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return chunk;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
if (!this.world.savingDisabled) {
|
||||
// CraftBukkit start
|
||||
|
@ -114,6 +129,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
|
||||
server.getPluginManager().callEvent(event);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-x, -z);
|
||||
chunk.setNeighborUnloaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||
public boolean e(int i, int j) {
|
||||
return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
|
||||
|
@ -154,6 +178,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborUnloaded(-xx, -zz);
|
||||
chunk.setNeighborUnloaded(xx, zz);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
world.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||
chunk = world.getChunkProviderServer().getOrLoadChunkAt(x, z);
|
||||
|
@ -163,6 +196,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return chunk != null;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
continue;
|
||||
}
|
||||
|
||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
|
@ -172,4 +214,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
continue;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||
@@ -0,0 +0,0 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||
continue;
|
||||
}
|
||||
|
||||
- Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
|
||||
+ Chunk neighbor = queuedChunk.provider.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
||||
if (neighbor != null) {
|
||||
neighbor.setNeighborLoaded(-x, -z);
|
||||
chunk.setNeighborLoaded(x, z);
|
||||
--
|
Loading…
Reference in a new issue