13
0
geforkt von Mirrors/Paper

Make the recheckGaps method async like other lighting updates

Dieser Commit ist enthalten in:
Byteflux 2015-08-04 15:44:54 -07:00
Ursprung 6cbf685402
Commit 6bcae0c948
2 geänderte Dateien mit 40 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -37,6 +37,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
this.q = true;
@@ -0,0 +0,0 @@ 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;
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
@ -75,7 +108,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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)
{
@ -170,6 +203,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+
+ if (!Bukkit.isPrimaryThread()) {
+ return this.c(enumskyblock, position, chunk, neighbors);
+ }
+
+ lightingExecutor.submit(new Runnable() {
+ @Override
+ public void run() {
@ -198,6 +235,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ log( "World async lighting: " + useAsyncLighting );
+ }
}
--
1.9.5.msysgit.1
--

Datei anzeigen

@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ 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<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<Explosion.CacheKey, Float>(); // PaperSpigot - Optimize explosions
public static long chunkToKey(int x, int z)