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-06-03 16:38:03 +02:00
|
|
|
import net.minecraft.client.model.ModelRenderer;
|
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-11-02 10:57:57 +01:00
|
|
|
public abstract class ModelMobPony extends ModelAlicorn {
|
2018-04-25 16:40:47 +02:00
|
|
|
|
|
|
|
public ModelMobPony() {
|
|
|
|
super(false);
|
|
|
|
}
|
|
|
|
|
2018-06-03 16:38:03 +02:00
|
|
|
/**
|
|
|
|
* Rotates the provided arm to the correct orientation for holding an item.
|
|
|
|
*
|
|
|
|
* @param arm The arm to rotate
|
|
|
|
* @param direction Direction multiplier. 1 for right, -1 for left.
|
|
|
|
* @param swingProgress How far we are through the current swing
|
|
|
|
* @param ticks Render partial ticks
|
|
|
|
*/
|
|
|
|
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float ticks) {
|
|
|
|
float swing = MathHelper.sin(swingProgress * PI);
|
|
|
|
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PI);
|
|
|
|
|
|
|
|
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
|
|
|
float sin = MathHelper.sin(ticks * 0.067F) / 10;
|
|
|
|
|
|
|
|
arm.rotateAngleX = -1.5707964F;
|
|
|
|
arm.rotateAngleX -= swing * 1.2F - roll * 0.4F;
|
|
|
|
arm.rotateAngleX += sin;
|
|
|
|
|
|
|
|
arm.rotateAngleY = direction * (0.1F - swing * 0.6F);
|
|
|
|
arm.rotateAngleZ = cos;
|
|
|
|
}
|
2018-04-25 16:40:47 +02:00
|
|
|
}
|