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