Files
TiedUp-/src/main/java/com/tiedup/remake/client/animation/StaticPoseApplier.java
NotEvil f6466360b6 Clean repo for open source release
Remove build artifacts, dev tool configs, unused dependencies,
and third-party source dumps. Add proper README, update .gitignore,
clean up Makefile.
2026-04-12 00:51:22 +02:00

138 lines
4.2 KiB
Java

package com.tiedup.remake.client.animation;
import com.tiedup.remake.items.base.PoseType;
import net.minecraft.client.model.HumanoidModel;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
/**
* Applies static bondage poses directly to HumanoidModel.
*
* <p>Used for entities that don't support PlayerAnimator (e.g., MCA villagers).
* Directly modifies arm/leg rotations on the model.
*
* <p>Extracted from BondageAnimationManager to separate concerns:
* BondageAnimationManager handles PlayerAnimator layers,
* StaticPoseApplier handles raw model manipulation.
*/
@OnlyIn(Dist.CLIENT)
public class StaticPoseApplier {
/**
* Apply a static bondage pose directly to a HumanoidModel.
*
* @param model The humanoid model to modify
* @param poseType The pose type (STANDARD, STRAITJACKET, WRAP, LATEX_SACK)
* @param armsBound whether ARMS region is occupied
* @param legsBound whether LEGS region is occupied
*/
public static void applyStaticPose(
HumanoidModel<?> model,
PoseType poseType,
boolean armsBound,
boolean legsBound
) {
if (model == null) {
return;
}
applyBodyPose(model, poseType);
if (armsBound) {
applyArmPose(model, poseType);
}
if (legsBound) {
applyLegPose(model, poseType);
}
}
/**
* Apply arm pose based on pose type.
* Values converted from animation JSON (degrees to radians).
*/
private static void applyArmPose(
HumanoidModel<?> model,
PoseType poseType
) {
switch (poseType) {
case STANDARD -> {
model.rightArm.xRot = 0.899f;
model.rightArm.yRot = 1.0f;
model.rightArm.zRot = 0f;
model.leftArm.xRot = 0.899f;
model.leftArm.yRot = -1.0f;
model.leftArm.zRot = 0f;
}
case STRAITJACKET -> {
model.rightArm.xRot = 0.764f;
model.rightArm.yRot = -0.84f;
model.rightArm.zRot = 0f;
model.leftArm.xRot = 0.764f;
model.leftArm.yRot = 0.84f;
model.leftArm.zRot = 0f;
}
case WRAP, LATEX_SACK -> {
model.rightArm.xRot = 0f;
model.rightArm.yRot = 0f;
model.rightArm.zRot = -0.087f;
model.leftArm.xRot = 0f;
model.leftArm.yRot = 0f;
model.leftArm.zRot = 0.087f;
}
case DOG -> {
model.rightArm.xRot = -2.094f;
model.rightArm.yRot = 0.175f;
model.rightArm.zRot = 0f;
model.leftArm.xRot = -2.094f;
model.leftArm.yRot = -0.175f;
model.leftArm.zRot = 0f;
}
case HUMAN_CHAIR -> {
model.rightArm.xRot = -2.094f;
model.rightArm.yRot = 0.175f;
model.rightArm.zRot = 0f;
model.leftArm.xRot = -2.094f;
model.leftArm.yRot = -0.175f;
model.leftArm.zRot = 0f;
}
}
}
/**
* Apply leg pose based on pose type.
*/
private static void applyLegPose(
HumanoidModel<?> model,
PoseType poseType
) {
if (poseType == PoseType.DOG || poseType == PoseType.HUMAN_CHAIR) {
model.rightLeg.xRot = -1.047f;
model.rightLeg.yRot = 0.349f;
model.rightLeg.zRot = 0f;
model.leftLeg.xRot = -1.047f;
model.leftLeg.yRot = -0.349f;
model.leftLeg.zRot = 0f;
} else {
model.rightLeg.xRot = 0f;
model.rightLeg.yRot = 0f;
model.rightLeg.zRot = -0.1f;
model.leftLeg.xRot = 0f;
model.leftLeg.yRot = 0f;
model.leftLeg.zRot = 0.1f;
}
}
/**
* Apply body pose for DOG/HUMAN_CHAIR pose.
*/
public static void applyBodyPose(
HumanoidModel<?> model,
PoseType poseType
) {
if (poseType == PoseType.DOG || poseType == PoseType.HUMAN_CHAIR) {
model.body.xRot = -1.571f;
}
}
}