From 18e97a487dc53e9e51c9d643dddb57f1b7354947 Mon Sep 17 00:00:00 2001 From: tterrag Date: Thu, 19 Dec 2019 23:13:28 -0500 Subject: [PATCH] Fix diffuse lighting being baked into models, fixes dark items --- .../renderer/BlockModelRenderer.java.patch | 17 ++++++++++++++++- .../client/renderer/model/FaceBakery.java.patch | 13 +++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch index c7b9667511..4b083cafb2 100644 --- a/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java.patch @@ -79,7 +79,22 @@ if (!list1.isEmpty()) { this.func_228798_a_(p_228806_1_, p_228806_3_, p_228806_4_, -1, p_228806_11_, true, p_228806_5_, p_228806_6_, list1, bitset); flag = true; -@@ -208,7 +222,11 @@ +@@ -125,6 +139,14 @@ + f1 = 1.0F; + f2 = 1.0F; + } ++ // FORGE: Apply diffuse lighting at render-time instead of baking it in ++ if (p_228800_6_.shouldApplyDiffuseLighting()) { ++ // TODO this should be handled by the forge lighting pipeline ++ float l = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(p_228800_6_.func_178210_d()); ++ f *= l; ++ f1 *= l; ++ f2 *= l; ++ } + + p_228800_4_.func_227890_a_(p_228800_5_, p_228800_6_, new float[]{p_228800_7_, p_228800_8_, p_228800_9_, p_228800_10_}, f, f1, f2, new int[]{p_228800_11_, p_228800_12_, p_228800_13_, p_228800_14_}, p_228800_15_, true); + } +@@ -208,7 +230,11 @@ } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch index 273e517afb..904a0460fc 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,6 +1,15 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java -@@ -43,7 +43,8 @@ +@@ -36,14 +36,16 @@ + blockfaceuv.field_178351_a[2] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[2], f1); + blockfaceuv.field_178351_a[1] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[1], f2); + blockfaceuv.field_178351_a[3] = MathHelper.func_219799_g(f, blockfaceuv.field_178351_a[3], f2); +- int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, p_228824_8_); ++ // FORGE: Apply diffuse lighting at render-time instead of baking it in ++ int[] aint = this.func_228820_a_(blockfaceuv, p_228824_4_, p_228824_5_, this.func_199337_a(p_228824_1_, p_228824_2_), p_228824_6_.func_225615_b_(), p_228824_7_, false); + Direction direction = func_178410_a(aint); + System.arraycopy(afloat, 0, blockfaceuv.field_178351_a, 0, afloat.length); + if (p_228824_7_ == null) { this.func_178408_a(aint, direction); } @@ -10,7 +19,7 @@ } public static BlockFaceUV func_228821_a_(BlockFaceUV p_228821_0_, Direction p_228821_1_, TransformationMatrix p_228821_2_, ResourceLocation p_228821_3_) { -@@ -152,6 +153,8 @@ +@@ -152,6 +154,8 @@ p_228826_1_[i + 3] = p_228826_4_; p_228826_1_[i + 4] = Float.floatToRawIntBits(p_228826_5_.func_94214_a((double)p_228826_6_.func_178348_a(p_228826_2_))); p_228826_1_[i + 4 + 1] = Float.floatToRawIntBits(p_228826_5_.func_94207_b((double)p_228826_6_.func_178346_b(p_228826_2_)));