From 49bbdff418ae535cd4143a1f641365c7319b1f42 Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Mon, 28 Sep 2026 23:00:40 +0200 Subject: [PATCH] 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,