Add config to disable light recalculation optimizations

I really don't know how this could break things with light, but wanted to
let it be an option so we can try turning it off to fix some light bug reports
This commit is contained in:
Aikar 2019-03-02 16:22:01 -05:00
parent a684cde66b
commit 40e666b44a
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
3 changed files with 30 additions and 14 deletions

View file

@ -1,4 +1,4 @@
From 6c92d0caeef8704d497dde4e874735349fd2d7bc Mon Sep 17 00:00:00 2001 From c446c78ca3b39921088a44176c07bac9e3ddcfd9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 28 Sep 2018 20:46:29 -0400 Date: Fri, 28 Sep 2018 20:46:29 -0400
Subject: [PATCH] Optimize Light Recalculations Subject: [PATCH] Optimize Light Recalculations
@ -13,8 +13,24 @@ changes from 1 block to another.
Also optimizes to not repeatedly look up the same chunk for Also optimizes to not repeatedly look up the same chunk for
light lookups. light lookups.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index e042040557..0b54b7d789 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -523,6 +523,11 @@ public class PaperWorldConfig {
log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default");
}
+ public boolean optimizeLight = true;
+ private void optimizeLight() {
+ this.optimizeLight = getBoolean("optimize-light", optimizeLight);
+ }
+
public boolean antiXray;
public boolean asynchronous;
public EngineMode engineMode;
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index a002aabf3..cd7b6318f 100644 index a002aabf31..1cb9030dab 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -353,7 +353,7 @@ public class Chunk implements IChunkAccess { @@ -353,7 +353,7 @@ public class Chunk implements IChunkAccess {
@ -31,12 +47,12 @@ index a002aabf3..cd7b6318f 100644
if (flag1) { if (flag1) {
this.initLighting(); this.initLighting();
- } else { - } else {
+ } else if (block != block1) { // Paper - Optimize light recalculations + } else if (!world.paperConfig.optimizeLight || block != block1) { // Paper - Optimize light recalculations
this.runOrQueueLightUpdate(() -> { // Paper - Queue light update this.runOrQueueLightUpdate(() -> { // Paper - Queue light update
int i1 = iblockdata.b(this.world, blockposition); int i1 = iblockdata.b(this.world, blockposition);
int j1 = iblockdata1.b(this.world, blockposition); int j1 = iblockdata1.b(this.world, blockposition);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a6176c805..5dc32a6e5 100644 index 2224eeab27..57de5f48ab 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -591,8 +591,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -591,8 +591,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc

View file

@ -1,4 +1,4 @@
From 18bff8057f2af7ec53c12333d0c9ae8d51fd8c41 Mon Sep 17 00:00:00 2001 From 0311bc9696bff6505b6c3bca23b895f9df54991a Mon Sep 17 00:00:00 2001
From: Gabriele C <sgdc3.mail@gmail.com> From: Gabriele C <sgdc3.mail@gmail.com>
Date: Mon, 22 Oct 2018 17:34:10 +0200 Date: Mon, 22 Oct 2018 17:34:10 +0200
Subject: [PATCH] Add option to prevent players from moving into unloaded Subject: [PATCH] Add option to prevent players from moving into unloaded
@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 30985cdfc..2add466ac 100644 index d723868fc7..8210b22ebe 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -574,4 +574,9 @@ public class PaperWorldConfig { @@ -579,4 +579,9 @@ public class PaperWorldConfig {
replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks")); replacementBlocks = getList("anti-xray.replacement-blocks", Arrays.asList("stone", "planks"));
log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Chunk Edge Mode: " + chunkEdgeMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius);
} }
@ -20,7 +20,7 @@ index 30985cdfc..2add466ac 100644
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7e285c629..0ee9e7095 100644 index 7e285c629e..0ee9e70956 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -341,6 +341,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -341,6 +341,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {

View file

@ -1,4 +1,4 @@
From da8c71b49ad62be5a61d3bcfdd585d790dcff2eb Mon Sep 17 00:00:00 2001 From de0ef1fcdb2fa88d099d52b7cfb4d4cc56fb0690 Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1> From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600 Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm Subject: [PATCH] Optimize redstone algorithm
@ -19,10 +19,10 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings. Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 2add466ac..b499c58b7 100644 index 8210b22ebe..f259c4e514 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -579,4 +579,14 @@ public class PaperWorldConfig { @@ -584,4 +584,14 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() { private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false);
} }
@ -39,7 +39,7 @@ index 2add466ac..b499c58b7 100644
} }
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
new file mode 100644 new file mode 100644
index 000000000..21d9d6d7e index 0000000000..21d9d6d7ed
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
@@ -0,0 +1,910 @@ @@ -0,0 +1,910 @@
@ -954,7 +954,7 @@ index 000000000..21d9d6d7e
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 48c79568f..a09aa6944 100644 index 48c79568fb..a09aa69444 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -1122,7 +1122,7 @@ index 48c79568f..a09aa6944 100644
iblockdata.a(world, blockposition, 0); iblockdata.a(world, blockposition, 0);
world.setAir(blockposition); world.setAir(blockposition);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5a447f8ef..9338618f8 100644 index a21de9b3d5..2f12e35acb 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -648,6 +648,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc @@ -648,6 +648,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc