PaperMC/CraftBukkit-Patches/0031-Allow-Disabling-of-Random-Lighting-Updates.patch
2015-01-06 22:09:08 -06:00

51 lines
2.2 KiB
Diff

From 6faa338d786eb8df93d3e2e6cb15badfcda7a0ea Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 22 Jun 2013 16:12:02 +1000
Subject: [PATCH] Allow Disabling of Random Lighting Updates
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9e65ff7..2e715b3 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -982,7 +982,7 @@ public class Chunk {
}
this.p = true;
- if (!this.lit && this.done) {
+ if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight
this.n();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d85479b..dad3d19 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2017,7 +2017,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.a("playerCheckLight");
- if (!this.players.isEmpty()) {
+ if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot
i = this.random.nextInt(this.players.size());
entityhuman = (EntityHuman) this.players.get(i);
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 956c628..8868ea3 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -179,4 +179,11 @@ public class SpigotWorldConfig
hopperAmount = getInt( "hopper-amount", 1 );
log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck + " Hopper Amount: " + hopperAmount );
}
+
+ public boolean randomLightUpdates;
+ private void lightUpdates()
+ {
+ randomLightUpdates = getBoolean( "random-light-updates", false );
+ log( "Random Lighting Updates: " + randomLightUpdates );
+ }
}
--
2.1.0