From fb685edbfbc442797850c3985c8758411562ba0c Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 25 Feb 2023 18:51:54 +0000 Subject: [PATCH] Fix hidden stack rendering --- .../client/gui/spellbook/IngredientTree.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java index 179763ca..fdeb89e2 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java +++ b/src/main/java/com/minelittlepony/unicopia/client/gui/spellbook/IngredientTree.java @@ -11,6 +11,7 @@ import com.minelittlepony.common.client.gui.element.Button; import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; import com.minelittlepony.unicopia.client.gui.ItemTraitsTooltipRenderer; +import com.minelittlepony.unicopia.client.render.PassThroughVertexConsumer; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; @@ -199,6 +200,10 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { } static class HiddenStacks extends Stacks { + private static final PassThroughVertexConsumer.Parameters FIXTURE = new PassThroughVertexConsumer.Parameters().color((parent, r, g, b, a) -> { + parent.color(0, 0, 0, a); + }); + HiddenStacks(ItemStack[] stacks) { super(stacks); } @@ -224,15 +229,20 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder { if (bl) { DiffuseLighting.disableGuiDepthLighting(); } - itemRenderer.renderItem(stacks[index], ModelTransformation.Mode.GUI, false, new MatrixStack(), immediate, 0, OverlayTexture.DEFAULT_UV, model); - immediate.draw(); + RenderSystem.disableDepthTest(); + try { + itemRenderer.renderItem(stacks[index], ModelTransformation.Mode.GUI, false, new MatrixStack(), layer -> PassThroughVertexConsumer.of(immediate.getBuffer(layer), FIXTURE), 0, OverlayTexture.DEFAULT_UV, model); + immediate.draw(); + } catch (Exception e) { + // Sodium + } + RenderSystem.enableDepthTest(); if (bl) { DiffuseLighting.enableGuiDepthLighting(); } matrixStack.pop(); RenderSystem.applyModelViewMatrix(); - RenderSystem.setShaderColor(1, 1, 1, 1); }