Fix chunk leak issue with queued light updates
This commit is contained in:
parent
2304826f19
commit
bf2ed8af45
|
@ -1,4 +1,4 @@
|
||||||
From 510ca29c8152d471740af9cf9bd99f3f9c0af690 Mon Sep 17 00:00:00 2001
|
From 3e274493dd2ceaa090253d2797e7c5bdbd55d2d5 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Mon, 28 Mar 2016 20:55:47 -0400
|
Date: Mon, 28 Mar 2016 20:55:47 -0400
|
||||||
Subject: [PATCH] MC Utils
|
Subject: [PATCH] MC Utils
|
||||||
|
@ -7,14 +7,15 @@ Collection of utils to help reduce NMS diff
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..ffd3152
|
index 0000000..d3a256c
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||||
@@ -0,0 +1,119 @@
|
@@ -0,0 +1,141 @@
|
||||||
+package net.minecraft.server;
|
+package net.minecraft.server;
|
||||||
+
|
+
|
||||||
+import org.bukkit.Location;
|
+import org.bukkit.Location;
|
||||||
+
|
+
|
||||||
|
+import javax.annotation.Nullable;
|
||||||
+import java.util.regex.Pattern;
|
+import java.util.regex.Pattern;
|
||||||
+
|
+
|
||||||
+public class MCUtil {
|
+public class MCUtil {
|
||||||
|
@ -129,6 +130,27 @@ index 0000000..ffd3152
|
||||||
+ final int modZ = pos.getZ() & 15;
|
+ final int modZ = pos.getZ() & 15;
|
||||||
+ return (modX == 0 || modX == 15 || modZ == 0 || modZ == 15);
|
+ return (modX == 0 || modX == 15 || modZ == 0 || modZ == 15);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets a chunk without changing its boolean for should unload
|
||||||
|
+ * @param world
|
||||||
|
+ * @param x
|
||||||
|
+ * @param z
|
||||||
|
+ * @return
|
||||||
|
+ */
|
||||||
|
+ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(World world, int x, int z) {
|
||||||
|
+ return ((ChunkProviderServer) world.chunkProvider).chunks.get(ChunkCoordIntPair.a(x, z));
|
||||||
|
+ }
|
||||||
|
+ /**
|
||||||
|
+ * Gets a chunk without changing its boolean for should unload
|
||||||
|
+ * @param provider
|
||||||
|
+ * @param x
|
||||||
|
+ * @param z
|
||||||
|
+ * @return
|
||||||
|
+ */
|
||||||
|
+ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(ChunkProviderServer provider, int x, int z) {
|
||||||
|
+ return provider.chunks.get(ChunkCoordIntPair.a(x, z));
|
||||||
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
|
||||||
index c01cecb..7fa49dd 100644
|
index c01cecb..7fa49dd 100644
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 254eb4d02c98435ce53fc85794f9912f9b3c63e2 Mon Sep 17 00:00:00 2001
|
From 5efa3dbdcbafbb869d80578874d617adbdbbe687 Mon Sep 17 00:00:00 2001
|
||||||
From: Byteflux <byte@byteflux.net>
|
From: Byteflux <byte@byteflux.net>
|
||||||
Date: Wed, 2 Mar 2016 00:52:31 -0600
|
Date: Wed, 2 Mar 2016 00:52:31 -0600
|
||||||
Subject: [PATCH] Lighting Queue
|
Subject: [PATCH] Lighting Queue
|
||||||
|
@ -32,7 +32,7 @@ index 7c0e61f..8e3a0f3 100644
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
index 5690e81..3bcbbb9 100644
|
index 5690e81..42fef0a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -45,6 +45,7 @@ public class Chunk {
|
@@ -45,6 +45,7 @@ public class Chunk {
|
||||||
|
@ -122,7 +122,7 @@ index 5690e81..3bcbbb9 100644
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ Chunk chunk = world.getChunkIfLoaded(x, z);
|
+ Chunk chunk = MCUtil.getLoadedChunkWithoutMarkingActive(world, x, z);
|
||||||
+ if (chunk != null && chunk.lightUpdates > 0) {
|
+ if (chunk != null && chunk.lightUpdates > 0) {
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -1,46 +1,34 @@
|
||||||
From 0e5163d49b0f3e4f8f0db6d6c65afd55256e7487 Mon Sep 17 00:00:00 2001
|
From 9df0a1beae6afe76606eb96db443a735faf77eba Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Thu, 12 May 2016 01:55:17 -0400
|
Date: Thu, 12 May 2016 01:55:17 -0400
|
||||||
Subject: [PATCH] Fix chunk unload leak issues due to neighbor updates
|
Subject: [PATCH] Do not mark chunks as active for neighbor updates
|
||||||
|
|
||||||
|
Fixes chunk unload issues
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
index 8ee8e80..694f3d5 100644
|
index 8ee8e80..1bc001d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
@@ -78,6 +78,12 @@ public class ChunkProviderServer implements IChunkProvider {
|
@@ -197,7 +197,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+ // Paper start
|
|
||||||
+ @Nullable
|
|
||||||
+ public Chunk getLoadedChunkAtWithoutMarkingActive(int i, int j) {
|
|
||||||
+ return this.chunks.get(ChunkCoordIntPair.a(i, j));
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public Chunk getLoadedChunkAt(int i, int j) {
|
|
||||||
@@ -197,7 +203,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
- Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
- Chunk neighbor = this.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
+ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborLoaded(-x, -z);
|
neighbor.setNeighborLoaded(-x, -z);
|
||||||
chunk.setNeighborLoaded(x, z);
|
chunk.setNeighborLoaded(x, z);
|
||||||
@@ -318,7 +324,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
@@ -318,7 +318,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
- Chunk neighbor = this.chunks.get(ChunkCoordIntPair.a(chunk.locX + x, chunk.locZ + z));
|
- Chunk neighbor = this.chunks.get(ChunkCoordIntPair.a(chunk.locX + x, chunk.locZ + z));
|
||||||
+ Chunk neighbor = this.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
+ Chunk neighbor = MCUtil.getLoadedChunkWithoutMarkingActive(this, chunk.locX + x, chunk.locZ + z); // Paper
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborUnloaded(-x, -z);
|
neighbor.setNeighborUnloaded(-x, -z);
|
||||||
chunk.setNeighborUnloaded(x, z);
|
chunk.setNeighborUnloaded(x, z);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 1adfc03..8246964 100644
|
index 1adfc03..b1a7435 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -241,7 +241,7 @@ public class CraftWorld implements World {
|
@@ -241,7 +241,7 @@ public class CraftWorld implements World {
|
||||||
|
@ -48,7 +36,7 @@ index 1adfc03..8246964 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
+ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborUnloaded(-xx, -zz);
|
neighbor.setNeighborUnloaded(-xx, -zz);
|
||||||
chunk.setNeighborUnloaded(xx, zz);
|
chunk.setNeighborUnloaded(xx, zz);
|
||||||
|
@ -57,20 +45,28 @@ index 1adfc03..8246964 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
- net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||||
+ net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
+ net.minecraft.server.Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(world, chunk.locX + x, chunk.locZ + z); // Paper
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborLoaded(-x, -z);
|
neighbor.setNeighborLoaded(-x, -z);
|
||||||
chunk.setNeighborLoaded(x, z);
|
chunk.setNeighborLoaded(x, z);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||||
index 7b61b14..a1668e2 100644
|
index 7b61b14..7752b50 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
|
||||||
@@ -62,7 +62,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
@@ -5,7 +5,6 @@ import net.minecraft.server.Chunk;
|
||||||
|
import net.minecraft.server.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.ChunkRegionLoader;
|
||||||
|
import net.minecraft.server.NBTTagCompound;
|
||||||
|
-
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
|
||||||
|
|
||||||
|
@@ -62,7 +61,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
- Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
- Chunk neighbor = queuedChunk.provider.getLoadedChunkAt(chunk.locX + x, chunk.locZ + z);
|
||||||
+ Chunk neighbor = queuedChunk.provider.getLoadedChunkAtWithoutMarkingActive(chunk.locX + x, chunk.locZ + z); // Paper
|
+ Chunk neighbor = net.minecraft.server.MCUtil.getLoadedChunkWithoutMarkingActive(queuedChunk.provider, chunk.locX + x, chunk.locZ + z); // Paper
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborLoaded(-x, -z);
|
neighbor.setNeighborLoaded(-x, -z);
|
||||||
chunk.setNeighborLoaded(x, z);
|
chunk.setNeighborLoaded(x, z);
|
|
@ -1,11 +1,11 @@
|
||||||
From d2cbd64700e4bd54a1aec471f69977b63c6ea2ec Mon Sep 17 00:00:00 2001
|
From e5bd49a93687c1a4aed20c45b62283540017f6a0 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Thu, 12 May 2016 02:03:56 -0400
|
Date: Thu, 12 May 2016 02:03:56 -0400
|
||||||
Subject: [PATCH] Unmark chunk as unloading when unload is cancelled
|
Subject: [PATCH] Unmark chunk as unloading when unload is cancelled
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
index 4953e97..1981ae4 100644
|
index 1e172b8..f72b1f8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
@@ -46,7 +46,7 @@ public class Chunk {
|
@@ -46,7 +46,7 @@ public class Chunk {
|
||||||
|
@ -18,10 +18,10 @@ index 4953e97..1981ae4 100644
|
||||||
public int lightUpdates; // Paper - Number of queued light updates for this chunk
|
public int lightUpdates; // Paper - Number of queued light updates for this chunk
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
index 694f3d5..f67dbae 100644
|
index 1bc001d..7820ad9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
@@ -309,6 +309,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
@@ -303,6 +303,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
Chunk chunk = (Chunk) this.chunks.get(olong);
|
Chunk chunk = (Chunk) this.chunks.get(olong);
|
||||||
|
|
||||||
if (chunk != null && chunk.d) {
|
if (chunk != null && chunk.d) {
|
||||||
|
|
Loading…
Reference in New Issue