mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Added a transition into and out of the rainbooming pose
This commit is contained in:
parent
d7cc2d45cf
commit
614f4c3b63
1 changed files with 13 additions and 25 deletions
|
@ -14,7 +14,6 @@ import java.util.function.Supplier;
|
|||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.math.*;
|
||||
|
@ -180,8 +179,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
|
||||
protected void ponySleep() {
|
||||
rightArm.pitch = ROTATE_270;
|
||||
leftArm.pitch = ROTATE_270;
|
||||
rightArm.pitch = -ROTATE_90;
|
||||
leftArm.pitch = -ROTATE_90;
|
||||
|
||||
rightLeg.pitch = ROTATE_90;
|
||||
leftLeg.pitch = ROTATE_90;
|
||||
|
@ -286,8 +285,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
protected void rotateLegs(float move, float swing, float ticks, T entity) {
|
||||
if (attributes.isSwimming) {
|
||||
rotateLegsSwimming(move, swing, ticks, entity);
|
||||
} else if (attributes.isGoingFast) {
|
||||
rotateLegsInFlight(move, swing, ticks, entity);
|
||||
} else {
|
||||
rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
@ -335,22 +332,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
rightLeg.setAngles(right, 0, rightLeg.roll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates legs in quopy fashion whilst flying.
|
||||
*
|
||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
||||
float armX = attributes.isGoingFast ? ROTATE_270 : MathHelper.sin(-swing / 2);
|
||||
float legX = attributes.isGoingFast ? ROTATE_90 : MathHelper.sin(swing / 2);
|
||||
|
||||
leftArm.setAngles(armX, -0.2F, 0);
|
||||
rightArm.setAngles(armX, 0.2F, 0);
|
||||
leftLeg.setAngles(legX, 0.2F, leftLeg.roll);
|
||||
rightLeg.setAngles(legX, -0.2F, rightLeg.roll);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates legs in quopy fashion for walking.
|
||||
*
|
||||
|
@ -363,10 +344,17 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
float baseRotation = move * 0.6662F; // magic number ahoy
|
||||
float scale = swing / 4;
|
||||
|
||||
leftArm.setAngles(MathHelper.cos(baseRotation + angle) * scale, 0, 0);
|
||||
rightArm.setAngles(MathHelper.cos(baseRotation + PI + angle / 2) * scale, 0, 0);
|
||||
leftLeg.setAngles(MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale, 0, leftLeg.roll);
|
||||
rightLeg.setAngles(MathHelper.cos(baseRotation + angle / 5) * scale, 0, rightLeg.roll);
|
||||
float rainboomLegLotation = getMetadata().getInterpolator(attributes.interpolatorId).interpolate(
|
||||
"rainboom_leg_rotation",
|
||||
attributes.isGoingFast ? 1 : 0,
|
||||
10
|
||||
);
|
||||
float yAngle = 0.2F * rainboomLegLotation;
|
||||
|
||||
leftArm.setAngles(MathHelper.lerp(rainboomLegLotation, MathHelper.cos(baseRotation + angle) * scale, -ROTATE_90 * rainboomLegLotation), -yAngle, 0);
|
||||
rightArm.setAngles(MathHelper.lerp(rainboomLegLotation, MathHelper.cos(baseRotation + PI + angle / 2) * scale, -ROTATE_90 * rainboomLegLotation), yAngle, 0);
|
||||
leftLeg.setAngles(MathHelper.lerp(rainboomLegLotation, MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale, ROTATE_90 * rainboomLegLotation), yAngle, leftLeg.roll);
|
||||
rightLeg.setAngles(MathHelper.lerp(rainboomLegLotation, MathHelper.cos(baseRotation + angle / 5) * scale, ROTATE_90 * rainboomLegLotation), -yAngle, rightLeg.roll);
|
||||
}
|
||||
|
||||
protected float getLegOutset() {
|
||||
|
|
Loading…
Reference in a new issue