From 11635988ce2858915446a4df168ef604859388d0 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Mon, 18 Dec 2017 07:35:42 +0000 Subject: [PATCH] Restore broken lighting logic from spigot --- .../Add-PlayerArmorChangeEvent.patch | 4 +- .../AsyncTabCompleteEvent.patch | 2 +- ...e-time-allowed-for-a-keepalive-reply.patch | 2 +- ...rom-being-processed-when-the-player-.patch | 2 +- ...with-fastutil-s-ObjectOpenHashSet-in.patch | 2 +- ...Disabling-of-Random-Lighting-Updates.patch | 62 ------------------- ...-chunks-not-being-sent-to-the-client.patch | 36 ----------- ...dEffects-only-to-players-who-can-see.patch | 4 +- ...e-implementations-for-captured-block.patch | 2 +- 9 files changed, 9 insertions(+), 107 deletions(-) delete mode 100644 Spigot-Server-Patches/Revert-Allow-Disabling-of-Random-Lighting-Updates.patch delete mode 100644 Spigot-Server-Patches/Revert-Fix-some-chunks-not-being-sent-to-the-client.patch diff --git a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch index 95b3b5acd8..2a5bc37d42 100644 --- a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 135a9c0e..559aebf2 100644 +index 135a9c0e2..559aebf20 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ @@ -30,7 +30,7 @@ index 135a9c0e..559aebf2 100644 if (!itemstack.isEmpty()) { this.getAttributeMap().a(itemstack.a(enumitemslot)); diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index cdf3a3ba..be5d0bf8 100644 +index cdf3a3ba4..be5d0bf89 100644 --- a/src/main/java/net/minecraft/server/EnumItemSlot.java +++ b/src/main/java/net/minecraft/server/EnumItemSlot.java @@ -0,0 +0,0 @@ public enum EnumItemSlot { diff --git a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch index 1a9987c27d..6f51d9debb 100644 --- a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch @@ -80,7 +80,7 @@ index 5a620f3fd..ead0994f8 100644 public void a(PacketPlayInSettings packetplayinsettings) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index aa098172f..09eb79439 100644 +index 7370eae9f..7d3a04cb3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/Increase-time-allowed-for-a-keepalive-reply.patch b/Spigot-Server-Patches/Increase-time-allowed-for-a-keepalive-reply.patch index ac79c41a89..9b5445728f 100644 --- a/Spigot-Server-Patches/Increase-time-allowed-for-a-keepalive-reply.patch +++ b/Spigot-Server-Patches/Increase-time-allowed-for-a-keepalive-reply.patch @@ -10,7 +10,7 @@ tempermental due to lag spikes on the network thread, e.g. that caused by plugins that are interacting with netty. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 26fbb30f9..71fae9450 100644 +index a92bf8967..5a620f3fd 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/Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch index be272292fe..fb309b1f96 100644 --- a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 75df92836..eaac25dc3 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener, ITickable { diff --git a/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch b/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch index ee5926838d..437f318c97 100644 --- a/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch +++ b/Spigot-Server-Patches/Replace-HashSet-with-fastutil-s-ObjectOpenHashSet-in.patch @@ -13,7 +13,7 @@ ObjectOpenHashSet never uses compareTo(), so the inconsistencies of NextTickList Fixes https://github.com/PaperMC/Paper/issues/588 diff --git a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 80a5c29f3..cd864c404 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java +++ b/src/main/java/org/bukkit/craftbukkit/util/HashTreeSet.java @@ -0,0 +0,0 @@ import java.util.TreeSet; diff --git a/Spigot-Server-Patches/Revert-Allow-Disabling-of-Random-Lighting-Updates.patch b/Spigot-Server-Patches/Revert-Allow-Disabling-of-Random-Lighting-Updates.patch deleted file mode 100644 index fa285cafe5..0000000000 --- a/Spigot-Server-Patches/Revert-Allow-Disabling-of-Random-Lighting-Updates.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Wed, 4 Oct 2017 04:19:51 +0100 -Subject: [PATCH] Revert "Allow Disabling of Random Lighting Updates" - -This patch by Spigot allows the disabling of chunks to be lit as they're ticked by server -operators, the side effects of this is that there will potentially be chunks which are unlit -with an invalid skymaps, this could have potential implications on plugins which care about -this for checking the highest block in a region, as well as serves to just cause issues with -invalid lighting in chunks which isn't accurately fixed. - -There is inherently nothing random about these light updates, they're there to ensure that -the worlds lightmap is properly updated and disabling them only serves to cause sporadic -lighting issues in the world. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ed5959559..d6e6f4d3e 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 { - } - - this.r = true; -- if (!this.lit && this.done && this.world.spigotConfig.randomLightUpdates) { // Spigot - also use random light updates setting to determine if we should relight -+ if (!this.lit && this.done) { - this.o(); - } - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c03be509f..4318fe871 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - - protected void i() { - this.methodProfiler.a("playerCheckLight"); -- if (spigotConfig.randomLightUpdates && !this.players.isEmpty()) { // Spigot -+ if (!this.players.isEmpty()) { - int i = this.random.nextInt(this.players.size()); - EntityHuman entityhuman = (EntityHuman) this.players.get(i); - int 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 0b66f5e35..5234be42d 100644 ---- a/src/main/java/org/spigotmc/SpigotWorldConfig.java -+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -- } -- -+ - public boolean saveStructureInfo; - private void structureInfo() - { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Revert-Fix-some-chunks-not-being-sent-to-the-client.patch b/Spigot-Server-Patches/Revert-Fix-some-chunks-not-being-sent-to-the-client.patch deleted file mode 100644 index 4b9b53959f..0000000000 --- a/Spigot-Server-Patches/Revert-Fix-some-chunks-not-being-sent-to-the-client.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Wed, 4 Oct 2017 04:20:21 +0100 -Subject: [PATCH] Revert "Fix some chunks not being sent to the client" - -This patch actually allows chunks to be sent before lighting has been calculated in a chunk, -causing lighting to be invalid on chunks sent to clients. as lighting is done during chunk -population and the server tracks which chunks have been sent to the client, this is no longer -an issue. - -as the server tracks what chunks have and haven't been sent to the client (and the original -issue for this appears to have already been fixed in the server in 1.9), there is nothing -that this patch is actually achieving as of now. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index d6e6f4d3e..faa52c933 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 { - } - - public boolean isReady() { -- // Spigot Start -- /* -- * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. -- * Unfortunately this interferes with our modified chunk ticking algorithm, which will only tick chunks distant from the player on a very infrequent basis. -- * 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; -- // Spigot End -+ return this.r && this.done && this.lit; - } - - public boolean j() { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch index c12377be25..8b221c1a10 100644 --- a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index 579996d1e..347237055 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +index a706f510d..8d28d7e19 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 IBlockAccess { diff --git a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch index c196c55629..1b2e315902 100644 --- a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch @@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f9c5da59f..072b1201f 100644 +index ad55631cf..eb8a1c43c 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 IBlockAccess {