From c38e8ec349b25a282878ca375d643e791f8439e8 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 4 Aug 2015 15:44:54 -0700 Subject: [PATCH] Make the recheckGaps method async like other lighting updates --- ...041-Configurable-async-light-updates.patch | 49 ++++++++++++++++--- .../0054-Optimize-explosions.patch | 2 +- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/Spigot-Server-Patches/0041-Configurable-async-light-updates.patch b/Spigot-Server-Patches/0041-Configurable-async-light-updates.patch index c6b3f781e0..68137b235d 100644 --- a/Spigot-Server-Patches/0041-Configurable-async-light-updates.patch +++ b/Spigot-Server-Patches/0041-Configurable-async-light-updates.patch @@ -1,11 +1,11 @@ -From d07732a069908d93da75d3a248da456f696dd8a8 Mon Sep 17 00:00:00 2001 +From 91555b67e652b6e5797f45ddc4090b0f01f81371 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Wed, 1 Jul 2015 00:18:10 -0700 Subject: [PATCH] Configurable async light updates diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 7242d45..ab4de94 100644 +index 7242d45..5a3b22a 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -11,6 +11,8 @@ import java.util.Map; @@ -37,6 +37,39 @@ index 7242d45..ab4de94 100644 } this.q = true; +@@ -1044,7 +1050,7 @@ public class Chunk { + + public void b(boolean flag) { + if (this.k && !this.world.worldProvider.o() && !flag) { +- this.h(this.world.isClientSide); ++ this.recheckGaps(this.world.isClientSide); // PaperSpigot - Asynchronous lighting updates + } + + this.p = true; +@@ -1065,6 +1071,23 @@ public class Chunk { + + } + ++ /** ++ * PaperSpigot - Recheck gaps asynchronously. ++ */ ++ public void recheckGaps(final boolean isClientSide) { ++ if (!world.paperSpigotConfig.useAsyncLighting) { ++ this.h(isClientSide); ++ return; ++ } ++ ++ world.lightingExecutor.submit(new Runnable() { ++ @Override ++ public void run() { ++ Chunk.this.h(isClientSide); ++ } ++ }); ++ } ++ + public boolean isReady() { + // Spigot Start + /* diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 975d666..ae0f276 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -55,7 +88,7 @@ index 975d666..ae0f276 100644 if (!this.world.c(i, j)) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 915a02d..e0a7161 100644 +index 915a02d..ed0b63d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -18,6 +18,12 @@ import org.bukkit.generator.ChunkGenerator; @@ -75,7 +108,7 @@ index 915a02d..e0a7161 100644 public static boolean haveWeSilencedAPhysicsCrash; public static String blockLocation; private int tileTickPosition; -+ private ExecutorService lightingExecutor; // PaperSpigot - Asynchronous lighting updates ++ public ExecutorService lightingExecutor; // PaperSpigot - Asynchronous lighting updates public static long chunkToKey(int x, int z) { @@ -115,7 +148,7 @@ index 915a02d..e0a7161 100644 // CraftBukkit end return false; } else { -@@ -2479,11 +2486,66 @@ public abstract class World implements IBlockAccess { +@@ -2479,11 +2486,70 @@ public abstract class World implements IBlockAccess { } } @@ -170,6 +203,10 @@ index 915a02d..e0a7161 100644 + } + } + ++ if (!Bukkit.isPrimaryThread()) { ++ return this.c(enumskyblock, position, chunk, neighbors); ++ } ++ + lightingExecutor.submit(new Runnable() { + @Override + public void run() { @@ -199,5 +236,5 @@ index bcd8b65..fa9ae6c 100644 + } } -- -1.9.5.msysgit.1 +2.4.6.windows.1 diff --git a/Spigot-Server-Patches/0054-Optimize-explosions.patch b/Spigot-Server-Patches/0054-Optimize-explosions.patch index 7468ffd4f4..12582c4bc5 100644 --- a/Spigot-Server-Patches/0054-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0054-Optimize-explosions.patch @@ -128,7 +128,7 @@ index b3e77d5..39cf1a3 100644 @@ -133,6 +133,7 @@ public abstract class World implements IBlockAccess { public static String blockLocation; private int tileTickPosition; - private ExecutorService lightingExecutor; // PaperSpigot - Asynchronous lighting updates + public ExecutorService lightingExecutor; // PaperSpigot - Asynchronous lighting updates + public final Map explosionDensityCache = new HashMap(); // PaperSpigot - Optimize explosions public static long chunkToKey(int x, int z)