Skip to content

Commit

Permalink
adjust some model limb positions (fixed silly bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Jul 24, 2024
1 parent 96f2554 commit 394c5a8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/mixces/legacyanimations/LegacyAnimations.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ public void onInitialize()
context.getSource().sendFeedback(() -> Text.literal("x: " + value + " y: " + value2 + " z: " + value3), false);
return 1;
})
.then(CommandManager.argument("yaw", FloatArgumentType.floatArg())
.then(CommandManager.argument("pitch", FloatArgumentType.floatArg())
.executes(context -> {
final float value = FloatArgumentType.getFloat(context, "x");
final float value2 = FloatArgumentType.getFloat(context, "y");
final float value3 = FloatArgumentType.getFloat(context, "z");
final float value4 = FloatArgumentType.getFloat(context, "yaw");
final float value4 = FloatArgumentType.getFloat(context, "pitch");
TransformHook.translationX = value;
TransformHook.translationY = value2;
TransformHook.translationZ = value3;
TransformHook.rotationX = value4;
context.getSource().sendFeedback(() -> Text.literal("x: " + value + " y: " + value2 + " z: " + value3 + " yaw: " + value4), false);
return 1;
})
.then(CommandManager.argument("pitch", FloatArgumentType.floatArg())
.then(CommandManager.argument("yaw", FloatArgumentType.floatArg())
.executes(context -> {
final float value = FloatArgumentType.getFloat(context, "x");
final float value2 = FloatArgumentType.getFloat(context, "y");
final float value3 = FloatArgumentType.getFloat(context, "z");
final float value4 = FloatArgumentType.getFloat(context, "roll");
final float value5 = FloatArgumentType.getFloat(context, "pitch");
final float value4 = FloatArgumentType.getFloat(context, "pitch");
final float value5 = FloatArgumentType.getFloat(context, "yaw");
TransformHook.translationX = value;
TransformHook.translationY = value2;
TransformHook.translationZ = value3;
Expand All @@ -91,8 +91,8 @@ public void onInitialize()
final float value = FloatArgumentType.getFloat(context, "x");
final float value2 = FloatArgumentType.getFloat(context, "y");
final float value3 = FloatArgumentType.getFloat(context, "z");
final float value4 = FloatArgumentType.getFloat(context, "yaw");
final float value5 = FloatArgumentType.getFloat(context, "pitch");
final float value4 = FloatArgumentType.getFloat(context, "pitch");
final float value5 = FloatArgumentType.getFloat(context, "yaw");
final float value6 = FloatArgumentType.getFloat(context, "roll");
TransformHook.translationX = value;
TransformHook.translationY = value2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,38 @@ public abstract class BipedEntityModelMixin<T extends LivingEntity>
ordinal = 1
)
)
private void legacyAnimations$fixIncorrectArmPlacement(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci)
private void legacyAnimations$fixIncorrectArmPlacement2(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci)
{
if (!LegacyAnimationsSettings.CONFIG.instance().punchDuringUsage)
if (!LegacyAnimationsSettings.getInstance().punchDuringUsage)
{
return;
}

rightArm.roll = 0.0F;
leftArm.roll = 0.0F;
if (rightArmPose == BipedEntityModel.ArmPose.BOW_AND_ARROW)
final BipedEntityModel.ArmPose BOW_AND_ARROW = BipedEntityModel.ArmPose.BOW_AND_ARROW;
final boolean isRightArmPose = rightArmPose == BOW_AND_ARROW;
final boolean isLeftArmPose = leftArmPose == BOW_AND_ARROW;

if (!isRightArmPose && !isLeftArmPose)
{
return;
}

if (isRightArmPose)
{
rightArm.roll = 0.0F;
rightArm.yaw = -0.1F + head.yaw;
leftArm.yaw = 0.1F + head.yaw + 0.4F;
rightArm.pitch = (float) (-Math.PI / 2) + head.pitch;
leftArm.pitch = (float) (-Math.PI / 2) + head.pitch;
}
if (leftArmPose == BipedEntityModel.ArmPose.BOW_AND_ARROW)

if (isLeftArmPose)
{
leftArm.roll = 0.0F;
rightArm.yaw = -0.1F + head.yaw - 0.4F;
leftArm.yaw = 0.1F + head.yaw;
rightArm.pitch = (float) (-Math.PI / 2) + head.pitch;
leftArm.pitch = (float) (-Math.PI / 2) + head.pitch;
}

rightArm.pitch = (float) (-Math.PI / 2) + head.pitch;
leftArm.pitch = (float) (-Math.PI / 2) + head.pitch;
}

@Inject(
Expand All @@ -82,7 +91,7 @@ public abstract class BipedEntityModelMixin<T extends LivingEntity>
)
private void legacyAnimations$oldSneakValue1(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci)
{
if (!LegacyAnimationsSettings.CONFIG.instance().oldSneaking)
if (!LegacyAnimationsSettings.getInstance().oldSneaking)
{
return;
}
Expand Down Expand Up @@ -114,7 +123,7 @@ public abstract class BipedEntityModelMixin<T extends LivingEntity>
)
private void legacyAnimations$oldSneakValue2(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci)
{
if (!LegacyAnimationsSettings.CONFIG.instance().oldSneaking)
if (!LegacyAnimationsSettings.getInstance().oldSneaking)
{
return;
}
Expand All @@ -133,7 +142,7 @@ public abstract class BipedEntityModelMixin<T extends LivingEntity>
)
private void legacyAnimations$oldSneakValue3(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci)
{
if (!LegacyAnimationsSettings.CONFIG.instance().oldSneaking)
if (!LegacyAnimationsSettings.getInstance().oldSneaking)
{
return;
}
Expand Down Expand Up @@ -246,7 +255,7 @@ public abstract class BipedEntityModelMixin<T extends LivingEntity>
return;
}

arm.pitch = arm.pitch * 0.5F - (float) (Math.PI / 3);
arm.pitch *= 0.5F - (float) (Math.PI / 10) * 3;
arm.yaw = 0.0F;
}

Expand Down

0 comments on commit 394c5a8

Please sign in to comment.