From a47eadb9b0320e8d69f36476428c37f36a02b726 Mon Sep 17 00:00:00 2001 From: Ben Staddon Date: Fri, 2 Feb 2018 18:35:47 +0000 Subject: [PATCH] New hook in WorldProvider to control client lighting re-checks (#4645) --- .../network/NetHandlerPlayClient.java.patch | 9 +++++++++ .../minecraft/world/WorldProvider.java.patch | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch index a15519d23..36e36090a 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java.patch @@ -9,6 +9,15 @@ this.field_147299_f.field_71474_y.field_74318_M = p_147282_1_.func_149192_g(); this.field_147299_f.func_71403_a(this.field_147300_g); this.field_147299_f.field_71439_g.field_71093_bK = p_147282_1_.func_149194_f(); +@@ -745,7 +745,7 @@ + chunk.func_186033_a(p_147263_1_.func_186946_a(), p_147263_1_.func_149276_g(), p_147263_1_.func_149274_i()); + this.field_147300_g.func_147458_c(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15); + +- if (!p_147263_1_.func_149274_i() || !(this.field_147300_g.field_73011_w instanceof WorldProviderSurface)) ++ if (!p_147263_1_.func_149274_i() || this.field_147300_g.field_73011_w.shouldClientCheckLighting()) + { + chunk.func_76613_n(); + } @@ -757,7 +757,7 @@ if (tileentity != null) diff --git a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch index 7c6b9c595..06d6a46eb 100644 --- a/patches/minecraft/net/minecraft/world/WorldProvider.java.patch +++ b/patches/minecraft/net/minecraft/world/WorldProvider.java.patch @@ -65,7 +65,7 @@ } @SideOnly(Side.CLIENT) -@@ -241,6 +216,336 @@ +@@ -241,6 +216,352 @@ return new WorldBorder(); } @@ -118,6 +118,22 @@ + return 1.0; + } + ++ /** ++ * If this method returns true, then chunks received by the client will ++ * have {@link net.minecraft.world.chunk.Chunk#resetRelightChecks} called ++ * on them, queuing lighting checks for all air blocks in the chunk (and ++ * any adjacent light-emitting blocks). ++ * ++ * Returning true here is recommended if the chunk generator used also ++ * does this for newly generated chunks. ++ * ++ * @return true if lighting checks should be performed ++ */ ++ public boolean shouldClientCheckLighting() ++ { ++ return !(this instanceof WorldProviderSurface); ++ } ++ + @Nullable + @SideOnly(Side.CLIENT) + public net.minecraftforge.client.IRenderHandler getSkyRenderer()