mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 23:48:00 +01:00
Decompose ModelAlicorn into its constituents
This commit is contained in:
parent
3da7853265
commit
5686608969
7 changed files with 224 additions and 209 deletions
|
@ -52,7 +52,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
/**
|
/**
|
||||||
* Flag indicating that this model is performing a rainboom (flight).
|
* Flag indicating that this model is performing a rainboom (flight).
|
||||||
*/
|
*/
|
||||||
public boolean rainboom;
|
protected boolean rainboom;
|
||||||
|
|
||||||
public PlaneRenderer upperTorso;
|
public PlaneRenderer upperTorso;
|
||||||
public PlaneRenderer neck;
|
public PlaneRenderer neck;
|
||||||
|
@ -69,6 +69,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
||||||
|
*/
|
||||||
|
protected void checkRainboom(Entity entity, float swing) {
|
||||||
|
rainboom = canFly() && isFlying(entity) && swing >= 0.9999F;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*
|
*
|
||||||
|
@ -82,6 +89,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
|
checkRainboom(entity, swing);
|
||||||
|
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
|
|
||||||
float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F;
|
float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F;
|
||||||
|
@ -100,7 +109,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
rotateLook(move, swing, bodySwingRotation, ticks);
|
rotateLook(move, swing, bodySwingRotation, ticks);
|
||||||
|
|
||||||
setLegs(move, swing, ticks, entity);
|
setLegs(move, swing, ticks, entity);
|
||||||
holdItem(swing);
|
if (!rainboom) {
|
||||||
|
holdItem(swing);
|
||||||
|
}
|
||||||
swingItem(entity);
|
swingItem(entity);
|
||||||
|
|
||||||
if (isCrouching()) {
|
if (isCrouching()) {
|
||||||
|
@ -224,8 +235,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
||||||
float armX = MathHelper.sin(-swing / 2);
|
float armX = rainboom ? ROTATE_270 : MathHelper.sin(-swing / 2);
|
||||||
float legX = MathHelper.sin(swing / 2);
|
float legX = rainboom ? ROTATE_90 : MathHelper.sin(swing / 2);
|
||||||
|
|
||||||
bipedLeftArm.rotateAngleX = armX;
|
bipedLeftArm.rotateAngleX = armX;
|
||||||
bipedRightArm.rotateAngleX = armX;
|
bipedRightArm.rotateAngleX = armX;
|
||||||
|
@ -655,23 +666,26 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCrouching() {
|
public IPonyData getMetadata() {
|
||||||
return isSneak && !isFlying;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
public boolean isCrouching() {
|
||||||
*/
|
return !rainboom && isSneak && !isFlying;
|
||||||
protected void checkRainboom(Entity entity, float swing) {
|
|
||||||
rainboom = isFlying(entity) && swing >= 0.9999F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlying(Entity entity) {
|
public boolean isFlying(Entity entity) {
|
||||||
return (isFlying && metadata.getRace().hasWings()) ||
|
return (isFlying && canFly()) ||
|
||||||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
|
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGoingFast() {
|
||||||
|
return rainboom;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlying() {
|
public boolean isFlying() {
|
||||||
return isFlying;
|
return isFlying;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.model.capabilities;
|
||||||
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
import com.minelittlepony.model.armour.PonyArmor;
|
||||||
|
import com.minelittlepony.pony.data.IPonyData;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
@ -25,6 +26,8 @@ public interface IModel {
|
||||||
*/
|
*/
|
||||||
PonyArmor createArmour();
|
PonyArmor createArmour();
|
||||||
|
|
||||||
|
IPonyData getMetadata();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is on the ground and crouching.
|
* Returns true if this model is on the ground and crouching.
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +43,18 @@ public interface IModel {
|
||||||
*/
|
*/
|
||||||
boolean isFlying();
|
boolean isFlying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if we're flying really fast.
|
||||||
|
*/
|
||||||
|
boolean isGoingFast();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this model is being applied to a race that has wings.
|
||||||
|
*/
|
||||||
|
default boolean canFly() {
|
||||||
|
return getMetadata().getRace().hasWings();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the current model is a child or a child-like foal.
|
* Returns true if the current model is a child or a child-like foal.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,10 +4,7 @@ public interface IModelPegasus extends IModel {
|
||||||
/**
|
/**
|
||||||
* Returns true if the wings are spread.
|
* Returns true if the wings are spread.
|
||||||
*/
|
*/
|
||||||
boolean wingsAreOpen();
|
default boolean wingsAreOpen() {
|
||||||
|
return isFlying() || isCrouching();
|
||||||
/**
|
}
|
||||||
* Returns true if this model is being applied to a race that has wings.
|
|
||||||
*/
|
|
||||||
boolean canFly();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,13 @@
|
||||||
package com.minelittlepony.model.player;
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
import com.minelittlepony.model.components.UnicornHorn;
|
import com.minelittlepony.model.components.PegasusWings;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.EnumHandSide;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
|
||||||
|
|
||||||
/**
|
public PegasusWings wings;
|
||||||
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
|
||||||
*/
|
|
||||||
public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|
||||||
|
|
||||||
public PonyRenderer unicornArmRight;
|
|
||||||
public PonyRenderer unicornArmLeft;
|
|
||||||
|
|
||||||
public UnicornHorn horn;
|
|
||||||
|
|
||||||
public ModelAlicorn(boolean smallArms) {
|
public ModelAlicorn(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
|
@ -27,138 +16,23 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
@Override
|
@Override
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
super.init(yOffset, stretch);
|
super.init(yOffset, stretch);
|
||||||
horn = new UnicornHorn(this, yOffset, stretch);
|
wings = new PegasusWings(this, yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
|
|
||||||
unicornArmRight.rotateAngleY = 0;
|
if (canFly()) {
|
||||||
unicornArmLeft.rotateAngleY = 0;
|
wings.setRotationAngles(move, swing, ticks);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void adjustLegs(float move, float swing, float ticks) {
|
|
||||||
super.adjustLegs(move, swing, ticks);
|
|
||||||
|
|
||||||
unicornArmLeft.rotateAngleZ = 0;
|
|
||||||
unicornArmRight.rotateAngleZ = 0;
|
|
||||||
|
|
||||||
unicornArmLeft.rotateAngleX = 0;
|
|
||||||
unicornArmRight.rotateAngleX = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void holdItem(float swing) {
|
|
||||||
if (canCast()) {
|
|
||||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
|
||||||
|
|
||||||
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
|
||||||
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
|
|
||||||
} else {
|
|
||||||
super.holdItem(swing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void swingItem(Entity entity) {
|
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
EnumHandSide mainSide = getMainHand(entity);
|
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
if (canFly()) {
|
||||||
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
wings.render(scale);
|
||||||
if (swingProgress > -9990.0F && !isSleeping) {
|
|
||||||
swingArm(getUnicornArmForSide(mainSide));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.swingItem(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void swingArms(float ticks) {
|
|
||||||
if (isSleeping) return;
|
|
||||||
|
|
||||||
if (canCast()) {
|
|
||||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
|
||||||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
|
||||||
|
|
||||||
if (rightArmPose != ArmPose.EMPTY) {
|
|
||||||
unicornArmRight.rotateAngleZ += cos;
|
|
||||||
unicornArmRight.rotateAngleX += sin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (leftArmPose != ArmPose.EMPTY) {
|
|
||||||
unicornArmLeft.rotateAngleZ += cos;
|
|
||||||
unicornArmLeft.rotateAngleX += sin;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.swingArms(ticks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
|
|
||||||
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canCast() {
|
|
||||||
return metadata.hasMagic();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCasting() {
|
|
||||||
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMagicColor() {
|
|
||||||
return metadata.getGlowColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void sneakLegs() {
|
|
||||||
super.sneakLegs();
|
|
||||||
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
|
||||||
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
|
|
||||||
if (canCast()) {
|
|
||||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
|
|
||||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
|
|
||||||
} else {
|
|
||||||
super.aimBow(leftArm, rightArm, ticks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
|
||||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
|
||||||
|
|
||||||
if (canCast()) {
|
|
||||||
horn.render(scale);
|
|
||||||
if (isCasting()) {
|
|
||||||
horn.renderMagic(getMagicColor(), scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initLegTextures() {
|
|
||||||
super.initLegTextures();
|
|
||||||
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
|
||||||
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initLegPositions(float yOffset, float stretch) {
|
|
||||||
super.initLegPositions(yOffset, stretch);
|
|
||||||
float armY = THIRDP_ARM_CENTRE_Y - 6;
|
|
||||||
float armZ = THIRDP_ARM_CENTRE_Z - 2;
|
|
||||||
|
|
||||||
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
|
|
||||||
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,6 @@ package com.minelittlepony.model.player;
|
||||||
import com.minelittlepony.model.components.PegasusWings;
|
import com.minelittlepony.model.components.PegasusWings;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
|
||||||
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||||
|
@ -21,62 +19,15 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||||
wings = new PegasusWings(this, yOffset, stretch);
|
wings = new PegasusWings(this, yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCrouching() {
|
|
||||||
return super.isCrouching() && !rainboom;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
checkRainboom(entity, swing);
|
|
||||||
|
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
|
wings.setRotationAngles(move, swing, ticks);
|
||||||
if (bipedCape != null) {
|
|
||||||
wings.setRotationAngles(move, swing, ticks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
|
||||||
if (rainboom) {
|
|
||||||
bipedLeftArm.rotateAngleX = ROTATE_270;
|
|
||||||
bipedRightArm.rotateAngleX = ROTATE_270;
|
|
||||||
|
|
||||||
bipedLeftLeg.rotateAngleX = ROTATE_90;
|
|
||||||
bipedRightLeg.rotateAngleX = ROTATE_90;
|
|
||||||
|
|
||||||
bipedLeftArm.rotateAngleY = -0.2F;
|
|
||||||
bipedLeftLeg.rotateAngleY = 0.2F;
|
|
||||||
|
|
||||||
bipedRightArm.rotateAngleY = 0.2F;
|
|
||||||
bipedRightLeg.rotateAngleY = -0.2F;
|
|
||||||
} else {
|
|
||||||
super.rotateLegsInFlight(move, swing, ticks, entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void holdItem(float swing) {
|
|
||||||
if (!rainboom) {
|
|
||||||
super.holdItem(swing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
if (canFly()) {
|
wings.render(scale);
|
||||||
wings.render(scale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean wingsAreOpen() {
|
|
||||||
return isFlying || isCrouching();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canFly() {
|
|
||||||
return metadata.getRace().hasWings();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
164
src/main/java/com/minelittlepony/model/player/ModelUnicorn.java
Normal file
164
src/main/java/com/minelittlepony/model/player/ModelUnicorn.java
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.UnicornHorn;
|
||||||
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
||||||
|
*/
|
||||||
|
public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
|
|
||||||
|
public PonyRenderer unicornArmRight;
|
||||||
|
public PonyRenderer unicornArmLeft;
|
||||||
|
|
||||||
|
public UnicornHorn horn;
|
||||||
|
|
||||||
|
public ModelUnicorn(boolean smallArms) {
|
||||||
|
super(smallArms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(float yOffset, float stretch) {
|
||||||
|
super.init(yOffset, stretch);
|
||||||
|
horn = new UnicornHorn(this, yOffset, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
||||||
|
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||||
|
|
||||||
|
unicornArmRight.rotateAngleY = 0;
|
||||||
|
unicornArmLeft.rotateAngleY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void adjustLegs(float move, float swing, float ticks) {
|
||||||
|
super.adjustLegs(move, swing, ticks);
|
||||||
|
|
||||||
|
unicornArmLeft.rotateAngleZ = 0;
|
||||||
|
unicornArmRight.rotateAngleZ = 0;
|
||||||
|
|
||||||
|
unicornArmLeft.rotateAngleX = 0;
|
||||||
|
unicornArmRight.rotateAngleX = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void holdItem(float swing) {
|
||||||
|
if (canCast()) {
|
||||||
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
|
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
||||||
|
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
|
||||||
|
} else {
|
||||||
|
super.holdItem(swing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void swingItem(Entity entity) {
|
||||||
|
EnumHandSide mainSide = getMainHand(entity);
|
||||||
|
|
||||||
|
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
||||||
|
if (swingProgress > -9990.0F && !isSleeping) {
|
||||||
|
swingArm(getUnicornArmForSide(mainSide));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.swingItem(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void swingArms(float ticks) {
|
||||||
|
if (isSleeping) return;
|
||||||
|
|
||||||
|
if (canCast()) {
|
||||||
|
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||||
|
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||||
|
|
||||||
|
if (rightArmPose != ArmPose.EMPTY) {
|
||||||
|
unicornArmRight.rotateAngleZ += cos;
|
||||||
|
unicornArmRight.rotateAngleX += sin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (leftArmPose != ArmPose.EMPTY) {
|
||||||
|
unicornArmLeft.rotateAngleZ += cos;
|
||||||
|
unicornArmLeft.rotateAngleX += sin;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.swingArms(ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
|
||||||
|
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCast() {
|
||||||
|
return metadata.hasMagic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCasting() {
|
||||||
|
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMagicColor() {
|
||||||
|
return metadata.getGlowColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void sneakLegs() {
|
||||||
|
super.sneakLegs();
|
||||||
|
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
|
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
|
||||||
|
if (canCast()) {
|
||||||
|
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
|
||||||
|
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
|
||||||
|
} else {
|
||||||
|
super.aimBow(leftArm, rightArm, ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
|
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
|
if (canCast()) {
|
||||||
|
horn.render(scale);
|
||||||
|
if (isCasting()) {
|
||||||
|
horn.renderMagic(getMagicColor(), scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initLegTextures() {
|
||||||
|
super.initLegTextures();
|
||||||
|
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initLegPositions(float yOffset, float stretch) {
|
||||||
|
super.initLegPositions(yOffset, stretch);
|
||||||
|
float armY = THIRDP_ARM_CENTRE_Y - 6;
|
||||||
|
float armZ = THIRDP_ARM_CENTRE_Z - 2;
|
||||||
|
|
||||||
|
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
|
||||||
|
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -98,7 +98,7 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
||||||
|
|
||||||
if (player.isEntityAlive() && player.isPlayerSleeping()) return;
|
if (player.isEntityAlive() && player.isPlayerSleeping()) return;
|
||||||
|
|
||||||
if (ponyModel.rainboom) {
|
if (ponyModel.isGoingFast()) {
|
||||||
transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks);
|
transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue