New hook in WorldProvider to control client lighting re-checks (#4645)

This commit is contained in:
Ben Staddon 2018-02-02 18:35:47 +00:00 committed by LexManos
parent 094245fe06
commit a47eadb9b0
2 changed files with 26 additions and 1 deletions

View File

@ -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)

View File

@ -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()