From 40e666b44a6d4e672287ed775a8a47048f22990e 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 --- .../0367-Optimize-Light-Recalculations.patch | 24 +++++++++++++++---- ...event-players-from-moving-into-unloa.patch | 8 +++---- .../0400-Optimize-redstone-algorithm.patch | 12 +++++----- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/Spigot-Server-Patches/0367-Optimize-Light-Recalculations.patch b/Spigot-Server-Patches/0367-Optimize-Light-Recalculations.patch index 9a2caa0c8c..14e8041129 100644 --- a/Spigot-Server-Patches/0367-Optimize-Light-Recalculations.patch +++ b/Spigot-Server-Patches/0367-Optimize-Light-Recalculations.patch @@ -1,4 +1,4 @@ -From 6c92d0caeef8704d497dde4e874735349fd2d7bc Mon Sep 17 00:00:00 2001 +From c446c78ca3b39921088a44176c07bac9e3ddcfd9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 28 Sep 2018 20:46:29 -0400 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 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 -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 @@ -353,7 +353,7 @@ 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 @@ -591,8 +591,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc diff --git a/Spigot-Server-Patches/0388-Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/0388-Add-option-to-prevent-players-from-moving-into-unloa.patch index 04ec7f935d..feffc62823 100644 --- a/Spigot-Server-Patches/0388-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/Spigot-Server-Patches/0388-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -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 Date: Mon, 22 Oct 2018 17:34:10 +0200 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 -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 -@@ -574,4 +574,9 @@ public class PaperWorldConfig { +@@ -579,4 +579,9 @@ public class PaperWorldConfig { 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); } @@ -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 @@ -341,6 +341,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { diff --git a/Spigot-Server-Patches/0400-Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/0400-Optimize-redstone-algorithm.patch index e644f38f53..1370f399cc 100644 --- a/Spigot-Server-Patches/0400-Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/0400-Optimize-redstone-algorithm.patch @@ -1,4 +1,4 @@ -From da8c71b49ad62be5a61d3bcfdd585d790dcff2eb Mon Sep 17 00:00:00 2001 +From de0ef1fcdb2fa88d099d52b7cfb4d4cc56fb0690 Mon Sep 17 00:00:00 2001 From: theosib Date: Thu, 27 Sep 2018 01:43:35 -0600 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. 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 -@@ -579,4 +579,14 @@ public class PaperWorldConfig { +@@ -584,4 +584,14 @@ public class PaperWorldConfig { private void preventMovingIntoUnloadedChunks() { 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 new file mode 100644 -index 000000000..21d9d6d7e +index 0000000000..21d9d6d7ed --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -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 -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 @@ -1,5 +1,7 @@ @@ -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 @@ -648,6 +648,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc