From 8995de90676c60ef9e350b4d890975f197367f0f Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 28 Sep 2026 23:00:40 +0200 Subject: [PATCH 1/2] Stop the glass shader importing what older versions lack 1.21.4 and 1.21.5 read every shader's imports while loading resources, and dynamictransforms.glsl only exists from 1.21.6, so resources failed to load there. The glass shader declares the transforms block itself again, with LineWidth behind a define the pipeline sets before 1.21.11. Co-Authored-By: Claude Opus 5.5 --- .../org/saturnclient/impl/ui/GlassRenderer.java | 3 +++ .../assets/saturnclient/shaders/core/glass.fsh | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java b/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java index 37da9f3..9146cef 100644 --- a/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java +++ b/src/main/java/org/saturnclient/impl/ui/GlassRenderer.java @@ -48,6 +48,9 @@ public final class GlassRenderer { .withLocation(Identifier.of("saturnclient", "pipeline/glass")) .withFragmentShader(Identifier.of("saturnclient", "core/glass")) .withSampler("Sampler1") + // The transforms block ends with LineWidth before 1.21.11 (see glass.fsh). + //? if <1.21.11 + //.withShaderDefine("HAS_LINE_WIDTH") .build(); private static final Identifier BLUR = Identifier.ofVanilla("post_effect/blur.json"); diff --git a/src/main/resources/assets/saturnclient/shaders/core/glass.fsh b/src/main/resources/assets/saturnclient/shaders/core/glass.fsh index 7d5ee7e..e58609c 100644 --- a/src/main/resources/assets/saturnclient/shaders/core/glass.fsh +++ b/src/main/resources/assets/saturnclient/shaders/core/glass.fsh @@ -3,8 +3,18 @@ // Saturn's glass: the blurred game behind the screen, cut to a panel's shape. For 1.21.6 and // later; glass_pre_1_21_6.fsh (with glass.json, the program 1.21.4 loads) is for older versions. -// Vanilla's own, since its layout changes between versions (1.21.11 dropped LineWidth) -#moj_import +// Vanilla's transforms, laid out as the version has them: 1.21.6 to 1.21.10 end with LineWidth, which +// 1.21.11 dropped (GlassRenderer defines HAS_LINE_WIDTH there). Not imported: the include only exists +// from 1.21.6, and 1.21.4 and 1.21.5 still read every shader's imports while loading resources. +layout(std140) uniform DynamicTransforms { + mat4 ModelViewMat; + vec4 ColorModulator; + vec3 ModelOffset; + mat4 TextureMat; +#ifdef HAS_LINE_WIDTH + float LineWidth; +#endif +}; // The panel's rounded rectangle, the same texture its background is drawn with uniform sampler2D Sampler0; From 49bbdff418ae535cd4143a1f641365c7319b1f42 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 28 Sep 2026 23:00:40 +0200 Subject: [PATCH 2/2] Keep hats and cloaks on the posed head and body The hat only took the head's rotation from 1.21.5, and the cloak sat at a fixed spot with a hard-coded crouch, so crouching and emotes left them where the head and body had been. Both now follow the whole player (the root, which emotes like the backflip turn) and then the head or body, as vanilla places head items, and the cloak leans with the chest when an emote bends the torso. Co-Authored-By: Claude Opus 5.5 --- .../impl/cosmetics/CloakFeatureRenderer.java | 42 ++++++++++++++++--- .../impl/cosmetics/HatFeatureRenderer.java | 15 ++++--- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/saturnclient/impl/cosmetics/CloakFeatureRenderer.java b/src/main/java/org/saturnclient/impl/cosmetics/CloakFeatureRenderer.java index 046f3b0..ec350ad 100644 --- a/src/main/java/org/saturnclient/impl/cosmetics/CloakFeatureRenderer.java +++ b/src/main/java/org/saturnclient/impl/cosmetics/CloakFeatureRenderer.java @@ -4,15 +4,20 @@ import java.util.Arrays; import org.joml.Matrix3f; import org.joml.Matrix4f; +import org.joml.Quaternionf; import org.joml.Vector3f; import org.joml.Vector4f; import org.saturnclient.client.player.SaturnPlayer; import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.config.Config; import org.saturnclient.cosmetics.Cloaks; +import org.saturnclient.emotes.core.bend.LimbBend; +import org.saturnclient.emotes.core.bend.Vec3; +import org.saturnclient.emotes.fabric.access.BendablePart; import org.saturnclient.impl.cosmetics.utils.ShaderUtils; import org.saturnclient.saturnclient.SaturnRenderState; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumer; //? if >=1.21.9 { @@ -33,7 +38,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.equipment.EquipmentAsset; import net.minecraft.registry.RegistryKey; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; import net.minecraft.util.math.Vec3d; /** @@ -383,6 +387,25 @@ public class CloakFeatureRenderer extends FeatureRenderer=1.21.5 { + model.getRootPart().applyTransform(matrices); + model.body.applyTransform(matrices); + //?} else { + /*model.getRootPart().rotate(matrices); + model.body.rotate(matrices); + *///?} + followBend(matrices, model.body); + matrices.translate(0.0f, 0.0f, 0.12f); if (this.hasCustomModelForLayer(state.equippedChestStack, LayerType.HUMANOID)) { matrices.translate(0.0F, -0.053125F, 0.06875F); } - if (state.isInSneakingPose) { - matrices.translate(0, 0.16f, 0.0f); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(29.0f)); - } - long now = System.currentTimeMillis(); if (now - lastUpdate >= 20) { float velX = Math.min(0.8f, state.field_53537 / 108.0f); diff --git a/src/main/java/org/saturnclient/impl/cosmetics/HatFeatureRenderer.java b/src/main/java/org/saturnclient/impl/cosmetics/HatFeatureRenderer.java index 68196f0..5e9082a 100644 --- a/src/main/java/org/saturnclient/impl/cosmetics/HatFeatureRenderer.java +++ b/src/main/java/org/saturnclient/impl/cosmetics/HatFeatureRenderer.java @@ -1,6 +1,5 @@ package org.saturnclient.impl.cosmetics; -import org.joml.Quaternionf; import org.saturnclient.client.player.SaturnPlayer; import org.saturnclient.impl.cosmetics.obj.MtlLoader; import org.saturnclient.impl.cosmetics.obj.ObjModel; @@ -16,7 +15,6 @@ import net.minecraft.client.render.entity.feature.FeatureRendererContext; import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.render.entity.state.PlayerEntityRenderState; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.model.ModelPart; public class HatFeatureRenderer extends FeatureRenderer { public HatFeatureRenderer(FeatureRendererContext context) { @@ -41,11 +39,16 @@ public class HatFeatureRenderer extends FeatureRenderer=1.21.5 { - ModelPart head = this.getContextModel().head; - matrices.multiply(new Quaternionf().rotationZYX(head.roll, head.yaw, head.pitch)); - //?} else - //this.getContextModel().head.rotate(matrices); + model.getRootPart().applyTransform(matrices); + model.head.applyTransform(matrices); + //?} else { + /*model.getRootPart().rotate(matrices); + model.head.rotate(matrices); + *///?} ObjModel.cosmetic("hat", player.hat).render(MtlLoader.cosmetic(player.hat), matrices, output, light,