mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 14:27:59 +01:00
Snippity snippity. That should fix horn glows
This commit is contained in:
parent
12ec6c1302
commit
7ff68e0e4f
17 changed files with 153 additions and 148 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
import com.minelittlepony.model.armour.PonyArmor;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
import com.minelittlepony.pony.data.PonyData;
|
||||
import com.minelittlepony.pony.data.PonySize;
|
||||
|
@ -20,7 +21,7 @@ import static net.minecraft.client.renderer.GlStateManager.*;
|
|||
/**
|
||||
* TODO: move this into constructor and make separate classes for the races.
|
||||
*/
|
||||
public abstract class AbstractPonyModel extends ModelPlayer {
|
||||
public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||
|
||||
/**
|
||||
* The model's current scale.
|
||||
|
@ -78,9 +79,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
return side == EnumHandSide.RIGHT ? rightArmPose : leftArmPose;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this model is on the ground and crouching.
|
||||
*/
|
||||
@Override
|
||||
public boolean isCrouching() {
|
||||
return isSneak && !isFlying;
|
||||
}
|
||||
|
@ -92,21 +91,27 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
rainboom = isFlying(entity) && swing >= 0.9999F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given entity can and is flying, or has an elytra.
|
||||
*/
|
||||
@Override
|
||||
public boolean isFlying(Entity entity) {
|
||||
return (isFlying && metadata.getRace().hasWings()) ||
|
||||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current model is a child or a child-like foal.
|
||||
*/
|
||||
@Override
|
||||
public boolean isFlying() {
|
||||
return isFlying;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChild() {
|
||||
return metadata.getSize() == PonySize.FOAL || isChild;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSwingAmount() {
|
||||
return swingProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
|
||||
*/
|
||||
|
|
|
@ -38,11 +38,11 @@ public class ModelMobPony extends ModelAlicorn {
|
|||
protected void rotateRightArm(float move, float tick) {
|
||||
if (rightArmPose == ArmPose.EMPTY) return;
|
||||
|
||||
if (!metadata.hasMagic()) {
|
||||
rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
|
||||
} else {
|
||||
if (canCast()) {
|
||||
unicornArmRight.setRotationPoint(-7, 12, -2);
|
||||
rotateArmHolding(unicornArmRight, -1, swingProgress, tick);
|
||||
} else {
|
||||
rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ public class ModelMobPony extends ModelAlicorn {
|
|||
protected void rotateLeftArm(float move, float tick) {
|
||||
if (leftArmPose == ArmPose.EMPTY) return;
|
||||
|
||||
if (!metadata.hasMagic()) {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||
} else {
|
||||
if (!canCast()) {
|
||||
unicornArmRight.setRotationPoint(-7, 12, -2);
|
||||
rotateArmHolding(unicornArmLeft, -1, swingProgress, tick);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
@ -23,9 +22,15 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
textureHeight = 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) {
|
||||
bipedBody.rotateAngleY = bodySwing * 0.2F;
|
||||
bipedBody.rotateAngleY = bodySwing / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,8 +109,8 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
|
||||
@Override
|
||||
protected void initHeadTextures() {
|
||||
bipedHead = new ModelRenderer(this, 0, 0);
|
||||
bipedHeadwear = new ModelRenderer(this, 32, 0);
|
||||
bipedHead = new PonyRenderer(this, 0, 0);
|
||||
bipedHeadwear = new PonyRenderer(this, 32, 0);
|
||||
helmet = new PonyRenderer(this, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -119,7 +124,7 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
@Override
|
||||
protected void initLegTextures() {
|
||||
bipedRightArm = new PonyRenderer(this, 0, 16);
|
||||
bipedRightLeg = new ModelRenderer(this, 0, 16);
|
||||
bipedRightLeg = new PonyRenderer(this, 0, 16);
|
||||
|
||||
bipedLeftArm = new PonyRenderer(this, 0, 16).mirror();
|
||||
bipedLeftLeg = new PonyRenderer(this, 0, 16).mirror();
|
||||
|
@ -178,24 +183,6 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
leftLegging.rotateAt(bipedLeftLeg).rotateTo(bipedLeftLeg);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setLegs(float move, float swing, float tick, Entity entity) {
|
||||
super.setLegs(move, swing, tick, entity);
|
||||
syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sneakLegs() {
|
||||
super.sneakLegs();
|
||||
syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ponySleep() {
|
||||
super.ponySleep();
|
||||
syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean invisible) {
|
||||
super.setVisible(invisible);
|
||||
|
|
|
@ -6,15 +6,9 @@ package com.minelittlepony.model.armour;
|
|||
*/
|
||||
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
|
||||
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
aimBow(leftArmPose, rightArmPose, tick);
|
||||
super.adjustLegs(move, swing, tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fixSpecialRotationPoints(float move) {
|
||||
if (rightArmPose != ArmPose.EMPTY && !metadata.hasMagic()) {
|
||||
if (rightArmPose != ArmPose.EMPTY && !canCast()) {
|
||||
bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.minelittlepony.model.capabilities;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public interface IModel {
|
||||
|
||||
/**
|
||||
* Returns true if this model is on the ground and crouching.
|
||||
*/
|
||||
boolean isCrouching();
|
||||
|
||||
/**
|
||||
* Returns true if the given entity can and is flying, or has an elytra.
|
||||
*/
|
||||
boolean isFlying(Entity entity);
|
||||
|
||||
/**
|
||||
* Returns true if the model is flying.
|
||||
*/
|
||||
boolean isFlying();
|
||||
|
||||
/**
|
||||
* Returns true if the current model is a child or a child-like foal.
|
||||
*/
|
||||
boolean isChild();
|
||||
|
||||
float getSwingAmount();
|
||||
}
|
|
@ -1,5 +1,13 @@
|
|||
package com.minelittlepony.model.capabilities;
|
||||
|
||||
public interface IModelPegasus {
|
||||
public interface IModelPegasus extends IModel {
|
||||
/**
|
||||
* Returns true if the wings are spread.
|
||||
*/
|
||||
boolean wingsAreOpen();
|
||||
|
||||
/**
|
||||
* Returns true if this model is being applied to a race that has wings.
|
||||
*/
|
||||
boolean canFly();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,17 @@ import com.minelittlepony.render.PonyRenderer;
|
|||
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
|
||||
public interface IModelUnicorn {
|
||||
public interface IModelUnicorn extends IModel {
|
||||
PonyRenderer getUnicornArmForSide(EnumHandSide side);
|
||||
|
||||
/**
|
||||
* Returns true if this model is being applied to a race that can use magic.
|
||||
*/
|
||||
boolean canCast();
|
||||
|
||||
/**
|
||||
* Returns true if this model is currently using magic (horn is lit).
|
||||
* @return
|
||||
*/
|
||||
boolean isCasting();
|
||||
}
|
||||
|
|
|
@ -1,35 +1,32 @@
|
|||
package com.minelittlepony.model.components;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||
|
||||
public class PegasusWings extends ModelBase {
|
||||
public class PegasusWings {
|
||||
|
||||
private final AbstractPonyModel pony;
|
||||
private final IModelPegasus pegasus;
|
||||
|
||||
public final ModelWing leftWing;
|
||||
public final ModelWing rightWing;
|
||||
|
||||
public PegasusWings(AbstractPonyModel model, float yOffset, float stretch) {
|
||||
pony = model;
|
||||
public <T extends AbstractPonyModel & IModelPegasus> PegasusWings(T model, float yOffset, float stretch) {
|
||||
pegasus = model;
|
||||
|
||||
leftWing = new ModelWing(pony, false, 4f, yOffset, stretch, 32);
|
||||
rightWing = new ModelWing(pony, true, -6f, yOffset, stretch, 16);
|
||||
leftWing = new ModelWing(model, false, 4f, yOffset, stretch, 32);
|
||||
rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
if (!isVisible()) return;
|
||||
|
||||
public void setRotationAngles(float move, float swing, float ticks) {
|
||||
float flap = 0;
|
||||
float progress = pegasus.getSwingAmount();
|
||||
|
||||
if (pony.swingProgress > 0) {
|
||||
flap = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * PI * 2);
|
||||
if (progress > 0) {
|
||||
flap = MathHelper.sin(MathHelper.sqrt(progress) * PI * 2);
|
||||
} else {
|
||||
float pi = PI * (float) Math.pow(swing, 16);
|
||||
|
||||
|
@ -42,7 +39,7 @@ public class PegasusWings extends ModelBase {
|
|||
leftWing.rotateWalking(flap);
|
||||
rightWing.rotateWalking(-flap);
|
||||
|
||||
if (isExtended()) {
|
||||
if (pegasus.wingsAreOpen()) {
|
||||
float flapAngle = getWingRotationFactor(ticks);
|
||||
leftWing.rotateFlying(flapAngle);
|
||||
rightWing.rotateFlying(-flapAngle);
|
||||
|
@ -51,24 +48,14 @@ public class PegasusWings extends ModelBase {
|
|||
}
|
||||
|
||||
public float getWingRotationFactor(float ticks) {
|
||||
if (pony.isFlying) {
|
||||
if (pegasus.isFlying()) {
|
||||
return (MathHelper.sin(ticks * 0.536f) * 1) + ROTATE_270 + 0.4f;
|
||||
}
|
||||
return LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return pony.metadata.getRace().hasWings();
|
||||
}
|
||||
|
||||
public boolean isExtended() {
|
||||
return pony.isFlying || pony.isCrouching();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
if (!isVisible()) return;
|
||||
boolean standing = isExtended();
|
||||
public void render(float scale) {
|
||||
boolean standing = pegasus.wingsAreOpen();
|
||||
leftWing.render(standing, scale);
|
||||
rightWing.render(standing, scale);
|
||||
}
|
||||
|
|
|
@ -4,25 +4,16 @@ import com.minelittlepony.model.AbstractPonyModel;
|
|||
import com.minelittlepony.render.HornGlowRenderer;
|
||||
import com.minelittlepony.render.PonyRenderer;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
public class UnicornHorn extends ModelBase {
|
||||
|
||||
protected final AbstractPonyModel pony;
|
||||
public class UnicornHorn {
|
||||
|
||||
private PonyRenderer horn;
|
||||
private HornGlowRenderer glow;
|
||||
|
||||
private boolean usingMagic;
|
||||
|
||||
public UnicornHorn(AbstractPonyModel pony, float yOffset, float stretch) {
|
||||
this.pony = pony;
|
||||
|
||||
horn = new PonyRenderer(pony, 0, 3);
|
||||
glow = new HornGlowRenderer(pony, 0, 3);
|
||||
|
||||
|
@ -37,18 +28,11 @@ public class UnicornHorn extends ModelBase {
|
|||
.setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
if (!pony.metadata.getRace().hasHorn()) return;
|
||||
|
||||
public void render(float scale) {
|
||||
horn.render(scale);
|
||||
|
||||
if (usingMagic && pony.metadata.hasMagic()) {
|
||||
renderMagic(pony.metadata.getGlowColor(), scale);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderMagic(int tint, float scale) {
|
||||
public void renderMagic(int tint, float scale) {
|
||||
glPushAttrib(24577);
|
||||
disableTexture2D();
|
||||
disableLighting();
|
||||
|
@ -63,8 +47,4 @@ public class UnicornHorn extends ModelBase {
|
|||
disableBlend();
|
||||
popAttrib();
|
||||
}
|
||||
|
||||
public void setUsingMagic(boolean usingMagic) {
|
||||
this.usingMagic = usingMagic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
|
||||
@Override
|
||||
protected void holdItem(float swing) {
|
||||
if (metadata.hasMagic()) {
|
||||
if (canCast()) {
|
||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||
|
||||
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
||||
|
@ -59,13 +59,11 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
} else {
|
||||
super.holdItem(swing);
|
||||
}
|
||||
|
||||
horn.setUsingMagic(leftArmPose != ArmPose.EMPTY || rightArmPose != ArmPose.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swingItem(Entity entity, float swingProgress) {
|
||||
if (metadata.hasMagic()) {
|
||||
if (canCast()) {
|
||||
if (swingProgress > -9990.0F && !isSleeping) {
|
||||
EnumHandSide mainSide = getMainHand(entity);
|
||||
|
||||
|
@ -81,9 +79,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
protected void swingArms(float tick) {
|
||||
if (isSleeping) return;
|
||||
|
||||
if (!metadata.hasMagic()) {
|
||||
super.swingArms(tick);
|
||||
} else {
|
||||
if (canCast()) {
|
||||
float cos = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
|
||||
|
@ -96,6 +92,8 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
unicornArmLeft.rotateAngleZ += cos;
|
||||
unicornArmLeft.rotateAngleX += sin;
|
||||
}
|
||||
} else {
|
||||
super.swingArms(tick);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,10 +103,15 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isCasting() {
|
||||
public boolean canCast() {
|
||||
return metadata.hasMagic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCasting() {
|
||||
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sneakLegs() {
|
||||
super.sneakLegs();
|
||||
|
@ -118,18 +121,24 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
|
||||
@Override
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||
if (!metadata.hasMagic()) {
|
||||
super.aimBow(leftArm, rightArm, tick);
|
||||
} else if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
||||
if (canCast()) {
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, tick, true);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, tick, false);
|
||||
} else {
|
||||
super.aimBow(leftArm, rightArm, tick);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderHead(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
super.renderHead(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
horn.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
|
||||
if (canCast()) {
|
||||
horn.render(scale);
|
||||
if (isCasting()) {
|
||||
horn.renderMagic(metadata.getGlowColor(), scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -272,7 +272,7 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
if (!isFlying && both) {
|
||||
swag -= (float)Math.pow(swing, 2);
|
||||
}
|
||||
float mult = 1 - swag/2f;
|
||||
float mult = 1 - swag/2;
|
||||
arm.rotateAngleX = bipedLeftArm.rotateAngleX * mult - (PI / 10) * swag;
|
||||
case EMPTY:
|
||||
arm.rotateAngleY = 0;
|
||||
|
@ -373,11 +373,9 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
}
|
||||
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, tick, false);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, tick, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected void aimBowPony(ModelRenderer arm, float tick, boolean shift) {
|
||||
arm.rotateAngleZ = 0;
|
||||
|
@ -458,6 +456,10 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
initHeadTextures();
|
||||
initBodyTextures();
|
||||
initLegTextures();
|
||||
initTailTextures();
|
||||
}
|
||||
|
||||
protected void initTailTextures() {
|
||||
tail = new PonyTail(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import static com.minelittlepony.model.PonyModelConstants.*;
|
|||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||
|
||||
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||
|
||||
public PegasusWings wings;
|
||||
|
||||
public ModelPegasus(boolean smallArms) {
|
||||
|
@ -32,7 +33,7 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
|
||||
if (bipedCape != null) {
|
||||
wings.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
wings.setRotationAngles(move, swing, age);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +59,18 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
wings.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
if (canFly()) {
|
||||
wings.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wingsAreOpen() {
|
||||
return isFlying || isCrouching();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFly() {
|
||||
return metadata.getRace().hasWings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.model.player.ModelAlicorn;
|
|||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.monster.AbstractIllager;
|
||||
import net.minecraft.entity.monster.AbstractIllager.IllagerArmPose;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
|
@ -19,11 +20,11 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
|
||||
AbstractIllager illager = (AbstractIllager) entity;
|
||||
AbstractIllager.IllagerArmPose pose = illager.getArmPose();
|
||||
IllagerArmPose pose = illager.getArmPose();
|
||||
|
||||
boolean rightHanded = illager.getPrimaryHand() == EnumHandSide.RIGHT;
|
||||
|
||||
if (pose == AbstractIllager.IllagerArmPose.ATTACKING) {
|
||||
if (pose == IllagerArmPose.ATTACKING) {
|
||||
// vindicator attacking
|
||||
float f = MathHelper.sin(swingProgress * (float) Math.PI);
|
||||
float f1 = MathHelper.sin((1.0F - (1.0F - swingProgress) * (1.0F - swingProgress)) * (float) Math.PI);
|
||||
|
@ -44,10 +45,7 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
bipedLeftArm.rotateAngleZ -= MathHelper.cos(age * 0.09F) * 0.05F + 0.05F;
|
||||
bipedRightArm.rotateAngleX += MathHelper.sin(age * 0.067F) * 0.05F;
|
||||
bipedLeftArm.rotateAngleX -= MathHelper.sin(age * 0.067F) * 0.05F;
|
||||
} else if (pose == AbstractIllager.IllagerArmPose.SPELLCASTING) {
|
||||
if (metadata.hasMagic()) {
|
||||
horn.setUsingMagic(true);
|
||||
}
|
||||
} else if (pose == IllagerArmPose.SPELLCASTING) {
|
||||
// waving arms!
|
||||
if (rightHanded) {
|
||||
// this.bipedRightArm.rotationPointZ = 0.0F;
|
||||
|
@ -63,7 +61,7 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
bipedLeftArm.rotateAngleY = -1.1F;
|
||||
}
|
||||
|
||||
} else if (pose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) {
|
||||
} else if (pose == IllagerArmPose.BOW_AND_ARROW) {
|
||||
if (rightHanded) {
|
||||
aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, age);
|
||||
} else {
|
||||
|
@ -73,6 +71,6 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
}
|
||||
|
||||
public ModelRenderer getArm(EnumHandSide side) {
|
||||
return metadata.hasMagic() ? getUnicornArmForSide(side) : getArmForSide(side);
|
||||
return canCast() ? getUnicornArmForSide(side) : getArmForSide(side);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.minelittlepony.model.ModelMobPony;
|
|||
import com.minelittlepony.model.armour.ModelSkeletonPonyArmor;
|
||||
import com.minelittlepony.model.armour.PonyArmor;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||
|
@ -17,10 +16,6 @@ import net.minecraft.util.EnumHandSide;
|
|||
|
||||
public class ModelSkeletonPony extends ModelMobPony {
|
||||
|
||||
public ModelSkeletonPony() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyArmor createArmour() {
|
||||
return new PonyArmor(new ModelSkeletonPonyArmor(), new ModelSkeletonPonyArmor());
|
||||
|
@ -28,31 +23,25 @@ public class ModelSkeletonPony extends ModelMobPony {
|
|||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||
rightArmPose = ModelBiped.ArmPose.EMPTY;
|
||||
leftArmPose = ModelBiped.ArmPose.EMPTY;
|
||||
rightArmPose = ArmPose.EMPTY;
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
ItemStack itemstack = entity.getHeldItem(EnumHand.MAIN_HAND);
|
||||
|
||||
if (itemstack.getItem() == Items.BOW && ((AbstractSkeleton)entity).isSwingingArms())
|
||||
{
|
||||
if (entity.getPrimaryHand() == EnumHandSide.RIGHT) {
|
||||
rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
rightArmPose = ArmPose.BOW_AND_ARROW;
|
||||
} else {
|
||||
leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
|
||||
leftArmPose = ArmPose.BOW_AND_ARROW;
|
||||
}
|
||||
}
|
||||
|
||||
super.setLivingAnimations(entity, move, swing, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
super.adjustLegs(move, swing, ticks);
|
||||
aimBow(leftArmPose, rightArmPose, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fixSpecialRotationPoints(float move) {
|
||||
if (rightArmPose != ArmPose.EMPTY && !metadata.hasMagic()) {
|
||||
if (rightArmPose != ArmPose.EMPTY && !canCast()) {
|
||||
bipedRightArm.setRotationPoint(-1.5F, 9.5F, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
|
||||
float angleY = 0;
|
||||
if (swingProgress > -9990.0F && !metadata.hasMagic()) {
|
||||
if (swingProgress > -9990.0F && !canCast()) {
|
||||
angleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.04F;
|
||||
}
|
||||
bag.rotateAngleY = angleY;
|
||||
|
|
|
@ -6,10 +6,6 @@ import com.minelittlepony.model.armour.PonyArmor;
|
|||
|
||||
public class ModelZombiePony extends ModelMobPony {
|
||||
|
||||
public ModelZombiePony() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyArmor createArmour() {
|
||||
return new PonyArmor(new ModelZombiePonyArmor(), new ModelZombiePonyArmor());
|
||||
|
|
|
@ -30,7 +30,7 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
|||
|
||||
private boolean isUnicorn() {
|
||||
ModelBase model = getMainModel();
|
||||
return model instanceof IModelUnicorn && ((IModelUnicorn) model).isCasting();
|
||||
return model instanceof IModelUnicorn && ((IModelUnicorn) model).canCast();
|
||||
}
|
||||
|
||||
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||
|
|
Loading…
Reference in a new issue