From 81f54a7fa477c853b2acf18b7c28c84412574b40 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 2 Mar 2019 16:22:01 -0500 Subject: [PATCH] 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 --- ...event-players-from-moving-into-unloa.patch | 4 ++-- .../Optimize-Light-Recalculations.patch | 22 ++++++++++++++++--- .../Optimize-redstone-algorithm.patch | 8 +++---- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch index 6b6315c8a9..8444b29338 100644 --- a/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,7 +6,7 @@ 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 -index 30985cdfc..2add466ac 100644 +index d723868fc7..8210b22ebe 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -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 -index 7e285c629..0ee9e7095 100644 +index 7e285c629e..0ee9e70956 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/Optimize-Light-Recalculations.patch b/Spigot-Server-Patches/Optimize-Light-Recalculations.patch index 2779211409..da8de1609f 100644 --- a/Spigot-Server-Patches/Optimize-Light-Recalculations.patch +++ b/Spigot-Server-Patches/Optimize-Light-Recalculations.patch @@ -13,8 +13,24 @@ changes from 1 block to another. Also optimizes to not repeatedly look up the same chunk for 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 +@@ -0,0 +0,0 @@ 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 -index a002aabf3..cd7b6318f 100644 +index a002aabf31..1cb9030dab 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 { @@ -31,12 +47,12 @@ index a002aabf3..cd7b6318f 100644 if (flag1) { this.initLighting(); - } 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 int i1 = iblockdata.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 -index a6176c805..5dc32a6e5 100644 +index 2224eeab27..57de5f48ab 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch index d9b7b1bb1f..7a542e2577 100644 --- a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch @@ -19,7 +19,7 @@ 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. 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 +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -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 new file mode 100644 -index 000000000..21d9d6d7e +index 0000000000..21d9d6d7ed --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -0,0 +0,0 @@ @@ -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 -index 48c79568f..a09aa6944 100644 +index 48c79568fb..a09aa69444 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -0,0 +0,0 @@ @@ -1122,7 +1122,7 @@ index 48c79568f..a09aa6944 100644 iblockdata.a(world, blockposition, 0); world.setAir(blockposition); 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 +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc