mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed seaponies
This commit is contained in:
parent
5f01814441
commit
21fab5e5fe
5 changed files with 156 additions and 76 deletions
|
@ -129,44 +129,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
swingItem(entity);
|
||||
|
||||
if (isCrouching()) {
|
||||
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
sneakLegs();
|
||||
setHead(0, 6, -2);
|
||||
ponyCrouch();
|
||||
} else if (isRiding) {
|
||||
adjustBodyRiding();
|
||||
bipedLeftLeg.rotationPointZ = 15;
|
||||
bipedLeftLeg.rotationPointY = 9;
|
||||
bipedLeftLeg.rotateAngleX = -PI / 4;
|
||||
bipedLeftLeg.rotateAngleY = -PI / 5;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 15;
|
||||
bipedRightLeg.rotationPointY = 9;
|
||||
bipedRightLeg.rotateAngleX = -PI / 4;
|
||||
bipedRightLeg.rotateAngleY = PI / 5;
|
||||
|
||||
bipedLeftArm.rotateAngleZ = -PI * 0.06f;
|
||||
bipedRightArm.rotateAngleZ = PI * 0.06f;
|
||||
|
||||
if (isRidingInteractive) {
|
||||
bipedLeftLeg.rotateAngleY = PI / 15;
|
||||
bipedLeftLeg.rotateAngleX = PI / 9;
|
||||
|
||||
bipedLeftLeg.rotationPointZ = 10;
|
||||
bipedLeftLeg.rotationPointY = 7;
|
||||
|
||||
bipedRightLeg.rotateAngleY = -PI / 15;
|
||||
bipedRightLeg.rotateAngleX = PI / 9;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 10;
|
||||
bipedRightLeg.rotationPointY = 7;
|
||||
|
||||
|
||||
bipedLeftArm.rotateAngleX = PI / 6;
|
||||
bipedRightArm.rotateAngleX = PI / 6;
|
||||
|
||||
bipedLeftArm.rotateAngleZ *= 2;
|
||||
bipedRightArm.rotateAngleZ *= 2;
|
||||
}
|
||||
ponyRide();
|
||||
} else {
|
||||
adjustBody(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
|
||||
|
||||
|
@ -176,13 +141,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
setHead(0, 0, 0);
|
||||
}
|
||||
|
||||
if (isSleeping) ponySleep();
|
||||
if (isSleeping) {
|
||||
ponySleep();
|
||||
}
|
||||
|
||||
animateWears();
|
||||
|
||||
snout.setGender(metadata.getGender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWobbleAmount() {
|
||||
|
||||
if (swingProgress <= 0) {
|
||||
|
@ -192,7 +160,36 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
return MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.04F;
|
||||
}
|
||||
|
||||
protected void adjustBodyRiding() {
|
||||
/**
|
||||
* Aligns legs to a sneaky position.
|
||||
*/
|
||||
protected void ponyCrouch() {
|
||||
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
setHead(0, 6, -2);
|
||||
|
||||
bipedRightArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
bipedLeftArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
|
||||
bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
}
|
||||
|
||||
protected void ponySleep() {
|
||||
bipedRightArm.rotateAngleX = ROTATE_270;
|
||||
bipedLeftArm.rotateAngleX = ROTATE_270;
|
||||
|
||||
bipedRightLeg.rotateAngleX = ROTATE_90;
|
||||
bipedLeftLeg.rotateAngleX = ROTATE_90;
|
||||
|
||||
setHead(1, 2, isSneak ? -1 : 1);
|
||||
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedRightArm, 0, 2, 6);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedLeftArm, 0, 2, 6);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedRightLeg, 0, 2, -8);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
||||
}
|
||||
|
||||
protected void ponyRide() {
|
||||
if (isRidingInteractive) {
|
||||
adjustBodyComponents(BODY_ROT_X_RIDING * 2, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
|
||||
adjustNeck(BODY_ROT_X_NOTSNEAK * 2, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK - 4);
|
||||
|
@ -203,7 +200,38 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
setHead(0, 0, 0);
|
||||
}
|
||||
|
||||
bipedLeftLeg.rotationPointZ = 15;
|
||||
bipedLeftLeg.rotationPointY = 9;
|
||||
bipedLeftLeg.rotateAngleX = -PI / 4;
|
||||
bipedLeftLeg.rotateAngleY = -PI / 5;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 15;
|
||||
bipedRightLeg.rotationPointY = 9;
|
||||
bipedRightLeg.rotateAngleX = -PI / 4;
|
||||
bipedRightLeg.rotateAngleY = PI / 5;
|
||||
|
||||
bipedLeftArm.rotateAngleZ = -PI * 0.06f;
|
||||
bipedRightArm.rotateAngleZ = PI * 0.06f;
|
||||
|
||||
if (isRidingInteractive) {
|
||||
bipedLeftLeg.rotateAngleY = PI / 15;
|
||||
bipedLeftLeg.rotateAngleX = PI / 9;
|
||||
|
||||
bipedLeftLeg.rotationPointZ = 10;
|
||||
bipedLeftLeg.rotationPointY = 7;
|
||||
|
||||
bipedRightLeg.rotateAngleY = -PI / 15;
|
||||
bipedRightLeg.rotateAngleX = PI / 9;
|
||||
|
||||
bipedRightLeg.rotationPointZ = 10;
|
||||
bipedRightLeg.rotationPointY = 7;
|
||||
|
||||
bipedLeftArm.rotateAngleX = PI / 6;
|
||||
bipedRightArm.rotateAngleX = PI / 6;
|
||||
|
||||
bipedLeftArm.rotateAngleZ *= 2;
|
||||
bipedRightArm.rotateAngleZ *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -387,8 +415,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
}
|
||||
|
||||
protected float getLegOutset() {
|
||||
if (isSleeping()) return 3.6f;
|
||||
if (isCrouching()) return 1;
|
||||
if (isSleeping()) {
|
||||
return 3.6f;
|
||||
}
|
||||
|
||||
if (isCrouching()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
@ -455,6 +489,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX + (MathHelper.sin(ticks * 0.067F) * 0.05F);
|
||||
arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F;
|
||||
arm.rotateAngleZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
|
||||
if (isSneak) {
|
||||
arm.rotationPointY += 4;
|
||||
}
|
||||
|
@ -498,7 +533,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
*/
|
||||
protected void swingArms(float ticks) {
|
||||
if (isSleeping()) return;
|
||||
if (isSleeping()) {
|
||||
return;
|
||||
}
|
||||
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
@ -533,30 +570,6 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns legs to a sneaky position.
|
||||
*/
|
||||
protected void sneakLegs() {
|
||||
bipedRightArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
bipedLeftArm.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
|
||||
bipedLeftLeg.rotationPointY = bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK;
|
||||
}
|
||||
|
||||
protected void ponySleep() {
|
||||
bipedRightArm.rotateAngleX = ROTATE_270;
|
||||
bipedLeftArm.rotateAngleX = ROTATE_270;
|
||||
bipedRightLeg.rotateAngleX = ROTATE_90;
|
||||
bipedLeftLeg.rotateAngleX = ROTATE_90;
|
||||
|
||||
setHead(1, 2, isSneak ? -1 : 1);
|
||||
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedRightArm, 0, 2, 6);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedLeftArm, 0, 2, 6);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedRightLeg, 0, 2, -8);
|
||||
AbstractBoxRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
boxList.clear();
|
||||
|
|
|
@ -88,6 +88,11 @@ public interface IModel extends ICapitated {
|
|||
*/
|
||||
float getSwingAmount();
|
||||
|
||||
/**
|
||||
* Gets the step woddle used for various hair bits and animations.
|
||||
*/
|
||||
float getWobbleAmount();
|
||||
|
||||
/**
|
||||
* Gets the y-offset applied to entities riding this one.
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.model.components;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPart;
|
||||
import com.minelittlepony.render.model.PlaneRenderer;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
@ -21,7 +22,11 @@ public class SeaponyTail implements IModelPart {
|
|||
private PlaneRenderer tailTip;
|
||||
private PlaneRenderer tailFins;
|
||||
|
||||
private IModel model;
|
||||
|
||||
public SeaponyTail(AbstractPonyModel model) {
|
||||
this.model = model;
|
||||
|
||||
tailBase = new PonyRenderer(model, 0, 38);
|
||||
tailTip = new PlaneRenderer(model, 24, 0);
|
||||
tailFins = new PlaneRenderer(model, 56, 20);
|
||||
|
@ -32,8 +37,11 @@ public class SeaponyTail implements IModelPart {
|
|||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
tailBase.rotate(TAIL_ROTX, 0, 0).around(-2, 14, 8)
|
||||
.box( 0, 0, 0, 4, 6, 4, stretch).flip();
|
||||
tailBase.rotate(TAIL_ROTX, 0, 0)
|
||||
.offset(0, -4, -2)
|
||||
.around(-2, 10, 8)
|
||||
.box( 0, 0, 0, 4, 6, 4, stretch)
|
||||
.flip();
|
||||
|
||||
tailTip.rotate(0, 0, 0).around(1, 5, 1)
|
||||
.box(0, 0, 0, 2, 6, 1, stretch);
|
||||
|
@ -45,9 +53,7 @@ public class SeaponyTail implements IModelPart {
|
|||
|
||||
@Override
|
||||
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
|
||||
float rotation = MathHelper.sin(ticks * 0.536f) / 4;
|
||||
|
||||
tailBase.offset(0, -4, -2).around(-2, 10, 8);
|
||||
float rotation = model.isSleeping() ? 0 : MathHelper.sin(ticks * 0.536f) / 4;
|
||||
|
||||
tailBase.rotateAngleX = TAIL_ROTX + rotation;
|
||||
tailTip.rotateAngleX = rotation;
|
||||
|
|
|
@ -127,8 +127,8 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void sneakLegs() {
|
||||
super.sneakLegs();
|
||||
protected void ponyCrouch() {
|
||||
super.ponyCrouch();
|
||||
unicornArmRight.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
unicornArmLeft.rotateAngleX -= LEG_ROT_X_SNEAK_ADJ;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.minelittlepony.model.ponies;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.ModelPonyArmor;
|
||||
import com.minelittlepony.model.armour.PonyArmor;
|
||||
import com.minelittlepony.model.components.SeaponyTail;
|
||||
import com.minelittlepony.model.player.ModelUnicorn;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
|
@ -27,6 +29,11 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
textureHeight = 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyArmor createArmour() {
|
||||
return new PonyArmor(new Armour(), new Armour());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
super.updateLivingState(entity, pony);
|
||||
|
@ -35,6 +42,16 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
isSneak = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ponySleep() {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ponyRide() {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initLegs(float yOffset, float stretch) {
|
||||
super.initLegs(yOffset, stretch);
|
||||
|
@ -75,11 +92,20 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
float finAngle = FIN_ROT_Y + MathHelper.cos(ticks / 10) / 5;
|
||||
float flapMotion = MathHelper.cos(ticks / 10) / 5;
|
||||
|
||||
if (isSleeping()) {
|
||||
flapMotion /= 2;
|
||||
}
|
||||
|
||||
float finAngle = FIN_ROT_Y + flapMotion;
|
||||
|
||||
leftFin.rotateAngleY = finAngle;
|
||||
rightFin.rotateAngleY = -finAngle;
|
||||
centerFin.rotateAngleZ = MathHelper.cos(ticks / 10) / 5;
|
||||
|
||||
if (!isSleeping()) {
|
||||
centerFin.rotateAngleZ = flapMotion;
|
||||
}
|
||||
|
||||
if (!entity.isInWater()) {
|
||||
bipedLeftArm.rotateAngleX -= 0.5F;
|
||||
|
@ -101,7 +127,6 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
bipedRightArm.rotateAngleY += 0.3F;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, Entity entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
|
@ -117,6 +142,8 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
|
||||
super.transform(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,4 +182,33 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
bipedLeftLegwear.showModel = false;
|
||||
bipedRightLegwear.showModel = false;
|
||||
}
|
||||
|
||||
class Armour extends ModelPonyArmor {
|
||||
|
||||
@Override
|
||||
public void showBoots() {
|
||||
bipedRightArm.showModel = true;
|
||||
bipedLeftArm.showModel = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(EntityLivingBase entity, IPony pony) {
|
||||
super.updateLivingState(entity, pony);
|
||||
|
||||
// Seaponies can't sneak, silly
|
||||
isSneak = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsSwimming(float move, float swing, float ticks, Entity entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
|
||||
super.transform(part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue