diff --git a/src/main/java/com/mixces/legacyanimations/LegacyAnimations.java b/src/main/java/com/mixces/legacyanimations/LegacyAnimations.java index 1501028..a16aa71 100644 --- a/src/main/java/com/mixces/legacyanimations/LegacyAnimations.java +++ b/src/main/java/com/mixces/legacyanimations/LegacyAnimations.java @@ -58,12 +58,12 @@ 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; @@ -71,13 +71,13 @@ public void onInitialize() 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; @@ -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; diff --git a/src/main/java/com/mixces/legacyanimations/mixin/BipedEntityModelMixin.java b/src/main/java/com/mixces/legacyanimations/mixin/BipedEntityModelMixin.java index d5c61b3..de46deb 100644 --- a/src/main/java/com/mixces/legacyanimations/mixin/BipedEntityModelMixin.java +++ b/src/main/java/com/mixces/legacyanimations/mixin/BipedEntityModelMixin.java @@ -33,29 +33,38 @@ public abstract class BipedEntityModelMixin 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( @@ -82,7 +91,7 @@ public abstract class BipedEntityModelMixin ) 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; } @@ -114,7 +123,7 @@ public abstract class BipedEntityModelMixin ) 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; } @@ -133,7 +142,7 @@ public abstract class BipedEntityModelMixin ) 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; } @@ -246,7 +255,7 @@ public abstract class BipedEntityModelMixin return; } - arm.pitch = arm.pitch * 0.5F - (float) (Math.PI / 3); + arm.pitch *= 0.5F - (float) (Math.PI / 10) * 3; arm.yaw = 0.0F; }