Fix hidden stack rendering

This commit is contained in:
Sollace 2023-02-25 18:51:54 +00:00
parent 71e6b4ac16
commit fb685edbfb

View file

@ -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.crafting.SpellbookRecipe;
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
import com.minelittlepony.unicopia.client.gui.ItemTraitsTooltipRenderer; import com.minelittlepony.unicopia.client.gui.ItemTraitsTooltipRenderer;
import com.minelittlepony.unicopia.client.render.PassThroughVertexConsumer;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
@ -199,6 +200,10 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
} }
static class HiddenStacks extends Stacks { 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) { HiddenStacks(ItemStack[] stacks) {
super(stacks); super(stacks);
} }
@ -224,15 +229,20 @@ class IngredientTree implements SpellbookRecipe.CraftingTreeBuilder {
if (bl) { if (bl) {
DiffuseLighting.disableGuiDepthLighting(); DiffuseLighting.disableGuiDepthLighting();
} }
itemRenderer.renderItem(stacks[index], ModelTransformation.Mode.GUI, false, new MatrixStack(), immediate, 0, OverlayTexture.DEFAULT_UV, model); RenderSystem.disableDepthTest();
immediate.draw(); 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(); RenderSystem.enableDepthTest();
if (bl) { if (bl) {
DiffuseLighting.enableGuiDepthLighting(); DiffuseLighting.enableGuiDepthLighting();
} }
matrixStack.pop(); matrixStack.pop();
RenderSystem.applyModelViewMatrix(); RenderSystem.applyModelViewMatrix();
RenderSystem.setShaderColor(1, 1, 1, 1); RenderSystem.setShaderColor(1, 1, 1, 1);
} }