mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 14:27:59 +01:00
Fix alignment of held shields and blocking
This commit is contained in:
parent
5178b8f40d
commit
51dc230d1a
2 changed files with 8 additions and 7 deletions
|
@ -330,8 +330,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
protected void holdItem(float swing) {
|
protected void holdItem(float swing) {
|
||||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
alignArmForAction(bipedLeftArm, leftArmPose, both, swing);
|
alignArmForAction(bipedLeftArm, leftArmPose, both, swing, 1);
|
||||||
alignArmForAction(bipedRightArm, rightArmPose, both, swing);
|
alignArmForAction(bipedRightArm, rightArmPose, both, swing, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -342,7 +342,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
* @param both True if we have something in both hands
|
* @param both True if we have something in both hands
|
||||||
* @param swing Degree to which each 'limb' swings.
|
* @param swing Degree to which each 'limb' swings.
|
||||||
*/
|
*/
|
||||||
protected void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) {
|
protected void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing, float reflect) {
|
||||||
switch (pose) {
|
switch (pose) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
float swag = 1;
|
float swag = 1;
|
||||||
|
@ -350,13 +350,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
swag -= (float)Math.pow(swing, 2);
|
swag -= (float)Math.pow(swing, 2);
|
||||||
}
|
}
|
||||||
float mult = 1 - swag/2;
|
float mult = 1 - swag/2;
|
||||||
arm.rotateAngleX = bipedLeftArm.rotateAngleX * mult - (PI / 10) * swag;
|
arm.rotateAngleX = arm.rotateAngleX * mult - (PI / 10) * swag;
|
||||||
|
arm.rotateAngleZ = -reflect * (mult - PI / 10);
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
arm.rotateAngleY = 0;
|
arm.rotateAngleY = 0;
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
|
arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F;
|
||||||
arm.rotateAngleY = PI / 6;
|
arm.rotateAngleY = reflect * PI / 6;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
alignArmForAction(unicornArmLeft, leftArmPose, both, swing, 1);
|
||||||
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
|
alignArmForAction(unicornArmRight, rightArmPose, both, swing, -1);
|
||||||
} else {
|
} else {
|
||||||
super.holdItem(swing);
|
super.holdItem(swing);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue