Paper/Spigot-Server-Patches/0252-Don-t-blindly-send-unlit-chunks-when-lighting-update.patch
Zach Brown 6f2009754d
Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:55:42 -04:00

49 Zeilen
2.2 KiB
Diff

From 92f05c91447dccd21a3efbb7708f813ce6bd1864 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 18 Dec 2017 07:26:56 +0000
Subject: [PATCH] Don't blindly send unlit chunks when lighting updates are
allowed
Spigot, by default, disables several mechanisms around how chunks are
lit, if ever, which has forced them to always send chunks before vanilla
would consider them ready to send, causing for lots of issues around
lighting glitches.
Shamefully, the amount of work to relight chunks can be detremental
to some servers, meaning that forcibily disabling light updates can
cause major performance issues.
as such, we make a compromise; if this "feature" is disabled, we will
only send chunks which are actually ready to be sent, otherwise, we
will always send chunks.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d1066d82..001fca42 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -39,7 +39,7 @@ public class Chunk {
final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this); // Paper
private boolean done;
private boolean lit;
- private boolean r;
+ private boolean r; private boolean isTicked() { return r; }; // Paper - OBFHELPER
private boolean s;
private boolean t;
private long lastSaved;
@@ -1136,7 +1136,11 @@ public class Chunk {
* We cannot unfortunately do this lighting stage during chunk gen as it appears to put a lot more noticeable load on the server, than when it is done at play time.
* For now at least we will simply send all chunks, in accordance with pre 1.7 behaviour.
*/
- return true;
+ // Paper Start
+ // if randomLightUpdates are enabled, we should always return true, otherwise chunks may never send
+ // to the client due to not being lit, otherwise retain standard behavior and only send properly lit chunks.
+ return !this.world.spigotConfig.randomLightUpdates || (this.isTicked() && this.done && this.lit);
+ // Paper End
// Spigot End
}
--
2.14.3