diff --git a/src/main/java/com/minelittlepony/client/render/ArmorRenderLayers.java b/src/main/java/com/minelittlepony/client/render/ArmorRenderLayers.java new file mode 100644 index 00000000..261732a3 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/render/ArmorRenderLayers.java @@ -0,0 +1,33 @@ +package com.minelittlepony.client.render; + +import net.minecraft.client.render.*; +import net.minecraft.client.render.RenderLayer.MultiPhaseParameters; +import net.minecraft.util.Identifier; +import net.minecraft.util.Util; + +import java.util.function.BiFunction; + +public class ArmorRenderLayers extends RenderPhase { + private ArmorRenderLayers() { + super(null, null, null); + } + + private static final BiFunction ARMOR_TRANSLUCENT_NO_CULL = Util.memoize((texture, decal) -> { + return RenderLayer.of(decal ? "armor_decal_translucent_no_cull" : "armor_translucent_no_cull", + VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, false, MultiPhaseParameters.builder() + .program(ARMOR_CUTOUT_NO_CULL_PROGRAM) + .texture(new RenderPhase.Texture(texture, false, false)) + .transparency(TRANSLUCENT_TRANSPARENCY) + .cull(DISABLE_CULLING) + .lightmap(ENABLE_LIGHTMAP) + .overlay(ENABLE_OVERLAY_COLOR) + .layering(VIEW_OFFSET_Z_LAYERING) + .depthTest(decal ? EQUAL_DEPTH_TEST : LEQUAL_DEPTH_TEST) + .build(true) + ); + }); + + public static RenderLayer getArmorTranslucentNoCull(Identifier texture, boolean decal) { + return ARMOR_TRANSLUCENT_NO_CULL.apply(texture, decal); + } +} diff --git a/src/main/java/com/minelittlepony/client/render/MagicGlow.java b/src/main/java/com/minelittlepony/client/render/MagicGlow.java index 4c868829..fc40525f 100644 --- a/src/main/java/com/minelittlepony/client/render/MagicGlow.java +++ b/src/main/java/com/minelittlepony/client/render/MagicGlow.java @@ -16,8 +16,8 @@ import java.util.function.BiFunction; import java.util.function.Supplier; public abstract class MagicGlow extends RenderPhase { - private MagicGlow(String name, Runnable beginAction, Runnable endAction) { - super(name, beginAction, endAction); + private MagicGlow() { + super(null, null, null); } private static final Supplier MAGIC = Suppliers.memoize(() -> { @@ -54,7 +54,6 @@ public abstract class MagicGlow extends RenderPhase { } private static class Colored extends Texture { - private final float red; private final float green; private final float blue; diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java index 2de77f75..1429caf5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/ArmourFeature.java @@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entity.feature; import com.minelittlepony.api.model.ModelWrapper; import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.client.model.armour.*; +import com.minelittlepony.client.render.ArmorRenderLayers; import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.common.util.Color; @@ -95,7 +96,7 @@ public class ArmourFeature & Po } private static VertexConsumer getArmorConsumer(VertexConsumerProvider provider, Identifier texture, boolean glint) { - return ItemRenderer.getArmorGlintConsumer(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint); + return ItemRenderer.getArmorGlintConsumer(provider, ArmorRenderLayers.getArmorTranslucentNoCull(texture, false), false, glint); } private static VertexConsumer getTrimConsumer(VertexConsumerProvider provider, ArmorMaterial material, ArmorTrim trim, ArmourLayer layer, boolean glint) { @@ -103,9 +104,8 @@ public class ArmourFeature & Po Sprite sprite = armorTrimsAtlas.getSprite( layer == ArmourLayer.INNER ? trim.getLeggingsModelId(material) : trim.getGenericModelId(material) ); + RenderLayer renderLayer = ArmorRenderLayers.getArmorTranslucentNoCull(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE, trim.getPattern().value().decal()); - return sprite.getTextureSpecificVertexConsumer( - ItemRenderer.getDirectItemGlintConsumer(provider, TexturedRenderLayers.getArmorTrims(trim.getPattern().value().decal()), true, glint) - ); + return sprite.getTextureSpecificVertexConsumer(ItemRenderer.getDirectItemGlintConsumer(provider, renderLayer, true, glint)); } }