Fix chunk leak issue with queued light updates

This commit is contained in:
Aikar
2016-05-13 01:34:37 -04:00
parent 2304826f19
commit bf2ed8af45
4 changed files with 54 additions and 36 deletions

View File

@@ -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>
Date: Mon, 28 Mar 2016 20:55:47 -0400
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
new file mode 100644
index 0000000..ffd3152
index 0000000..d3a256c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -0,0 +1,119 @@
@@ -0,0 +1,141 @@
+package net.minecraft.server;
+
+import org.bukkit.Location;
+
+import javax.annotation.Nullable;
+import java.util.regex.Pattern;
+
+public class MCUtil {
@@ -129,6 +130,27 @@ index 0000000..ffd3152
+ final int modZ = pos.getZ() & 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
index c01cecb..7fa49dd 100644