From 1fdbf82abdd4f7dc7153b5d9f57ec8b07e042664 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 30 Sep 2026 19:26:59 +0200 Subject: [PATCH] Draw hats and cloaks unlit on 26.1 Before 26.1 they use the dragon's alpha pipeline, whose shader only samples the texture. entityCutout, which 26.1 used instead, applies the lightmap and directional shading, so shadows and light from the world showed on them. 26.1 builds the same unlit cutout from the entity shader: the emissive snippet without the lightmap, plus NO_CARDINAL_LIGHTING and NO_OVERLAY. Co-Authored-By: Claude Opus 5.5 --- .../impl/cosmetics/utils/ShaderUtils.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/saturnclient/impl/cosmetics/utils/ShaderUtils.java b/src/main/java/org/saturnclient/impl/cosmetics/utils/ShaderUtils.java index e6e737c..40bab50 100644 --- a/src/main/java/org/saturnclient/impl/cosmetics/utils/ShaderUtils.java +++ b/src/main/java/org/saturnclient/impl/cosmetics/utils/ShaderUtils.java @@ -26,6 +26,10 @@ import net.minecraft.client.renderer.blockentity.AbstractEndPortalRenderer; import net.minecraft.client.renderer.blockentity.TheEndPortalRenderer; *///?} import net.minecraft.resources.Identifier; +//? if >=26.1 { +/*import java.util.HashMap; +import java.util.Map; +*///?} public class ShaderUtils { // Render pipelines exist from 1.21.5; before that the layer names a shader program directly. @@ -87,10 +91,26 @@ public class ShaderUtils { } } + // Cosmetics are drawn unlit, without the lightmap or the directional shading, as the dragon's + // alpha pipeline drew them before 26.1. 26.1 dropped that pipeline, so this is the entity shader + // with its lighting and overlay turned off. + //? if >=26.1 { + /*public static final RenderPipeline UNLIT_CUTOUT_PIPELINE = RenderPipelines.register( + RenderPipeline.builder(new RenderPipeline.Snippet[] { + RenderPipelines.ENTITY_EMISSIVE_SNIPPET }) + .withLocation(Identifier.fromNamespaceAndPath("saturnclient", "pipeline/unlit_cutout")) + .withShaderDefine("ALPHA_CUTOUT", 0.1f) + .withShaderDefine("NO_CARDINAL_LIGHTING") + .withShaderDefine("NO_OVERLAY") + .withCull(false) + .build()); + private static final Map UNLIT_CUTOUT = new HashMap<>(); + *///?} + private static RenderType entityAlpha(Identifier texture) { - // 26.1 dropped the dragon's alpha pipeline; with opaque vertices it's an alpha cutout. //? if >=26.1 { - /*return RenderTypes.entityCutout(texture); + /*return UNLIT_CUTOUT.computeIfAbsent(texture, id -> RenderType.create("saturn_unlit_cutout", + RenderSetup.builder(UNLIT_CUTOUT_PIPELINE).withTexture("Sampler0", id).createRenderSetup())); *///?} else if >=1.21.11 { return RenderTypes.dragonExplosionAlpha(texture); //?} else