2018-04-25 16:40:47 +02:00
|
|
|
package com.minelittlepony.model;
|
|
|
|
|
2018-04-28 16:39:32 +02:00
|
|
|
import com.minelittlepony.model.player.ModelAlicorn;
|
2018-04-25 16:40:47 +02:00
|
|
|
|
2018-04-28 16:39:32 +02:00
|
|
|
import net.minecraft.util.math.MathHelper;
|
2018-04-25 16:40:47 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Common class for all humanoid (ponioid?) non-player enemies.
|
|
|
|
*
|
|
|
|
*/
|
2018-04-28 16:39:32 +02:00
|
|
|
public class ModelMobPony extends ModelAlicorn {
|
2018-04-25 16:40:47 +02:00
|
|
|
|
|
|
|
public ModelMobPony() {
|
|
|
|
super(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-04-28 16:39:32 +02:00
|
|
|
protected void adjustLegs(float move, float swing, float tick) {
|
|
|
|
super.adjustLegs(move, swing, tick);
|
2018-04-25 21:29:49 +02:00
|
|
|
rotateRightArm(move, tick);
|
|
|
|
rotateLeftArm(move, tick);
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-04-28 16:39:32 +02:00
|
|
|
/**
|
|
|
|
* Returns true if the angle is to the right?
|
|
|
|
*/
|
|
|
|
public boolean islookAngleRight(float move) {
|
|
|
|
return MathHelper.sin(move / 20f) < 0;
|
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Called to update the left arm's final rotation.
|
|
|
|
* Subclasses may replace it with their own implementations.
|
2018-04-27 13:49:33 +02:00
|
|
|
*
|
2018-04-25 21:29:49 +02:00
|
|
|
* @param move Limb swing amount.
|
|
|
|
* @param tick Render partial ticks.
|
|
|
|
*/
|
|
|
|
protected void rotateRightArm(float move, float tick) {
|
2018-04-27 13:49:33 +02:00
|
|
|
if (rightArmPose == ArmPose.EMPTY) return;
|
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
if (!metadata.hasMagic()) {
|
2018-04-26 16:01:31 +02:00
|
|
|
rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
|
2018-04-25 16:40:47 +02:00
|
|
|
} else {
|
|
|
|
unicornArmRight.setRotationPoint(-7, 12, -2);
|
2018-04-26 16:01:31 +02:00
|
|
|
rotateArmHolding(unicornArmRight, -1, swingProgress, tick);
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Same as rotateRightArm but for the left arm (duh).
|
2018-04-27 13:49:33 +02:00
|
|
|
*
|
2018-04-25 21:29:49 +02:00
|
|
|
* @param move Limb swing amount.
|
|
|
|
* @param tick Render partial ticks.
|
|
|
|
*/
|
|
|
|
protected void rotateLeftArm(float move, float tick) {
|
2018-04-25 16:40:47 +02:00
|
|
|
if (leftArmPose == ArmPose.EMPTY) return;
|
|
|
|
|
|
|
|
if (!metadata.hasMagic()) {
|
2018-04-26 16:01:31 +02:00
|
|
|
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
2018-04-25 16:40:47 +02:00
|
|
|
} else {
|
|
|
|
unicornArmRight.setRotationPoint(-7, 12, -2);
|
2018-04-26 16:01:31 +02:00
|
|
|
rotateArmHolding(unicornArmLeft, -1, swingProgress, tick);
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|