Fix many light bugs by removing recheckGaps change

Fixes #1539
Fixes #1483
This commit is contained in:
Aikar
2018-10-06 00:56:20 -04:00
parent fd85b785ea
commit add0f4d4de
44 changed files with 97 additions and 140 deletions

View File

@@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
From: Aikar <aikar@aikar.co>
Date: Wed, 2 Mar 2016 00:52:31 -0600
Subject: [PATCH] Lighting Queue
@@ -28,7 +28,7 @@ index 145cb274b0..eff9dcf54f 100644
public static Timing getTickList(WorldServer worldserver, String timingsType) {
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 6ab2eaa169..27775476f9 100644
index 8be079e26e..0968852922 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +0,0 @@ public class PaperConfig {
@@ -37,7 +37,9 @@ index 6ab2eaa169..27775476f9 100644
+ public static int maxTickMsLostLightQueue;
+ private static void lightQueue() {
+ maxTickMsLostLightQueue = getInt("queue-light-updates-max-loss", 10);
+ int badSetting = config.getInt("queue-light-updates-max-loss", 10);
+ config.set("queue-light-updates-max-loss", null);
+ maxTickMsLostLightQueue = getInt("settings.queue-light-updates-max-loss", badSetting);
+ }
+
private static void timings() {
@@ -61,18 +63,9 @@ index 39d565db1f..8f6f0288be 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index af181d4bd7..4ec5fe739f 100644
index af181d4bd7..6fa379e580 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
public final Map<HeightMap.Type, HeightMap> heightMap;
public final int locX;
public final int locZ;
- private boolean l;
+ private boolean l; public boolean needsGapCheck() { return l; } // Paper - OBFHELPER
private final ChunkConverter m;
public final Map<BlockPosition, TileEntity> tileEntities;
public final List<Entity>[] entitySlices; // Spigot
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
return removed;
}
@@ -82,10 +75,7 @@ index af181d4bd7..4ec5fe739f 100644
public boolean areNeighborsLoaded(final int radius) {
switch (radius) {
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
this.l = true;
}
+ private void recheckGaps(boolean flag) { g(flag); } // Paper - OBFHELPER
private void g(boolean flag) {
this.world.methodProfiler.a("recheckGaps");
- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) {
@@ -118,26 +108,6 @@ index af181d4bd7..4ec5fe739f 100644
}
TileEntity tileentity;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
return false;
}
- public void d(boolean flag) {
- if (this.l && this.world.worldProvider.g() && !flag) {
- this.g(this.world.isClientSide);
+ // Paper start
+ private boolean shouldRecheckGaps = false;
+ public void doGapCheck() {
+ if (shouldRecheckGaps) {
+ this.recheckGaps(false);
+ shouldRecheckGaps = false;
}
+ }
+ public void d(boolean flag) {
+ shouldRecheckGaps = this.needsGapCheck() && this.world.worldProvider.hasNaturalLight() && !flag; // Paper
this.u = true;
@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess {
return this.D == 8;
}
@@ -190,7 +160,7 @@ index d6ea4ae532..5086fe4027 100644
}
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
new file mode 100644
index 0000000000..d207266db3
index 0000000000..5fabc5b55c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
@@ -0,0 +0,0 @@
@@ -224,7 +194,6 @@ index 0000000000..d207266db3
+ if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) {
+ break START;
+ }
+ chunk.doGapCheck();
+ }
+ }
+ }
@@ -306,17 +275,4 @@ index 499d64ea2c..e06da6bef9 100644
this.methodProfiler.e();
}
diff --git a/src/main/java/net/minecraft/server/WorldProvider.java b/src/main/java/net/minecraft/server/WorldProvider.java
index 517b1e7124..53ce7d5e11 100644
--- a/src/main/java/net/minecraft/server/WorldProvider.java
+++ b/src/main/java/net/minecraft/server/WorldProvider.java
@@ -0,0 +0,0 @@ public abstract class WorldProvider {
protected World b;
protected boolean c;
protected boolean d;
- protected boolean e;
+ protected boolean e; public boolean hasNaturalLight() { return e; } // Paper - OBFHELPER
protected final float[] f = new float[16];
private final float[] g = new float[4];
--