mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Add some more 1.9 functionality (left arm, shields, elytra)
This commit is contained in:
parent
ce71badc7a
commit
b1ae2daf44
10 changed files with 248 additions and 48 deletions
|
@ -99,7 +99,7 @@ public class Pony {
|
|||
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) {
|
||||
return false;
|
||||
}
|
||||
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater());
|
||||
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying());
|
||||
}
|
||||
|
||||
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
|
||||
|
|
|
@ -17,14 +17,17 @@ import com.brohoof.minelittlepony.ducks.IRenderPony;
|
|||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.model.PlayerModel;
|
||||
import com.brohoof.minelittlepony.model.pony.ModelHumanPlayer;
|
||||
import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonyCape;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonyElytra;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkull;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
|
@ -55,8 +58,9 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
this.addLayer(new LayerPonyArmor(this));
|
||||
this.addLayer(new LayerHeldPonyItem(this));
|
||||
this.addLayer(new LayerArrow(this));
|
||||
this.addLayer(new LayerPonySkull(this));
|
||||
this.addLayer(new LayerPonyCape(this));
|
||||
this.addLayer(new LayerPonySkull(this));
|
||||
this.addLayer(new LayerPonyElytra((RenderPlayer) (Object) this));
|
||||
}
|
||||
|
||||
@Inject(
|
||||
|
@ -162,6 +166,18 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
return this.playerModel.getModel().steveRightArmwear;
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "rotateCorpse(Lnet/minecraft/client/entity/AbstractClientPlayer;FFF)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
|
||||
ordinal = 3))
|
||||
private void rotateRedirect(float f1, float f2, float f3, float f4) {
|
||||
if (this.playerModel.getModel() instanceof ModelPlayerPony)
|
||||
f1 += 90;
|
||||
GlStateManager.rotate(f1, f2, f3, f4);
|
||||
}
|
||||
|
||||
private void updateModel(AbstractClientPlayer player) {
|
||||
this.thePony = MineLittlePony.getInstance().getManager().getPonyFromResourceRegistry(player);
|
||||
thePony.checkSkin();
|
||||
|
|
|
@ -62,7 +62,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
|
||||
protected void initPositions(float yOffset, float stretch) {}
|
||||
|
||||
protected void animate(float move, float swing, float tick, float horz, float vert) {}
|
||||
protected void animate(float move, float swing, float tick, float horz, float vert, Entity entityIn) {}
|
||||
|
||||
protected void render() {}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
super.setRotationAngles(Move, Moveswing, Loop, Right, Down, Scale, entityIn);
|
||||
return;
|
||||
}
|
||||
this.animate(Move, Moveswing, Loop, Right, Down);
|
||||
this.animate(Move, Moveswing, Loop, Right, Down, entityIn);
|
||||
for (IPonyPart part : modelParts) {
|
||||
part.animate(metadata, Move, Moveswing, Loop, Right, Down);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
ItemStack off = clientPlayer.getHeldItemMainhand();
|
||||
ItemStack off = clientPlayer.getHeldItemOffhand();
|
||||
ArmPose offPose;
|
||||
if (off == null) {
|
||||
offPose = ArmPose.EMPTY;
|
||||
|
@ -172,6 +172,11 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected ArmPose getMainArmPose(Entity entity) {
|
||||
EnumHandSide mainHand = this.getMainHand(entity);
|
||||
return mainHand == EnumHandSide.RIGHT ? this.rightArmPose : this.leftArmPose;
|
||||
}
|
||||
|
||||
public static void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) {
|
||||
aRenderer.rotationPointX = setX;
|
||||
aRenderer.rotationPointY = setY;
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package com.brohoof.minelittlepony.model;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class ModelPonyElytra extends ModelBase {
|
||||
private ModelRenderer rightWing;
|
||||
private ModelRenderer leftWing = new ModelRenderer(this, 22, 0);
|
||||
|
||||
public ModelPonyElytra() {
|
||||
this.leftWing.addBox(-10.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
|
||||
this.rightWing = new ModelRenderer(this, 22, 0);
|
||||
this.rightWing.mirror = true;
|
||||
this.rightWing.addBox(0.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float p_78088_2_, float limbSwing, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableCull();
|
||||
this.leftWing.render(scale);
|
||||
this.rightWing.render(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
|
||||
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||
final float PI = (float) Math.PI;
|
||||
float rotateX = PI / 2F;
|
||||
float rotateZ = PI / 12;
|
||||
float rpY = PonyModelConstants.BODY_RP_Y_NOTSNEAK;
|
||||
float rotateY = PI / 8F;
|
||||
|
||||
if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isElytraFlying()) {
|
||||
float f4 = 1.0F;
|
||||
|
||||
if (entityIn.motionY < 0.0D) {
|
||||
Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize();
|
||||
f4 = 1.0F - (float) Math.pow(-vec3d.yCoord, 1.5D);
|
||||
}
|
||||
|
||||
rotateX = f4 * PI * (2 / 3F) + (1.0F - f4) * rotateX;
|
||||
rotateY = f4 * ((float) Math.PI / 2F) + (1.0F - f4) * rotateY;
|
||||
} else if (entityIn.isSneaking()) {
|
||||
rotateX = ((float) Math.PI * 1.175F);
|
||||
rotateY = PI / 2;
|
||||
rpY = PonyModelConstants.BODY_RP_Y_SNEAK;
|
||||
rotateZ = PI / 4F;
|
||||
}
|
||||
|
||||
this.leftWing.rotationPointX = 5.0F;
|
||||
this.leftWing.rotationPointY = rpY;
|
||||
|
||||
if (entityIn instanceof AbstractClientPlayer) {
|
||||
AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer) entityIn;
|
||||
abstractclientplayer.rotateElytraX = (float) (abstractclientplayer.rotateElytraX + (rotateX - abstractclientplayer.rotateElytraX) * 0.1D);
|
||||
abstractclientplayer.rotateElytraY = (float) (abstractclientplayer.rotateElytraY + (rotateY - abstractclientplayer.rotateElytraY) * 0.1D);
|
||||
abstractclientplayer.rotateElytraZ = (float) (abstractclientplayer.rotateElytraZ + (rotateZ - abstractclientplayer.rotateElytraZ) * 0.1D);
|
||||
this.leftWing.rotateAngleX = abstractclientplayer.rotateElytraX;
|
||||
this.leftWing.rotateAngleY = abstractclientplayer.rotateElytraY;
|
||||
this.leftWing.rotateAngleZ = abstractclientplayer.rotateElytraZ;
|
||||
} else {
|
||||
this.leftWing.rotateAngleX = rotateX;
|
||||
this.leftWing.rotateAngleZ = rotateZ;
|
||||
this.leftWing.rotateAngleY = rotateY;
|
||||
}
|
||||
|
||||
this.rightWing.rotationPointX = -this.leftWing.rotationPointX;
|
||||
this.rightWing.rotateAngleY = -this.leftWing.rotateAngleY;
|
||||
this.rightWing.rotationPointY = this.leftWing.rotationPointY;
|
||||
this.rightWing.rotateAngleX = this.leftWing.rotateAngleX;
|
||||
this.rightWing.rotateAngleZ = -this.leftWing.rotateAngleZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
|
||||
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
|
||||
}
|
||||
}
|
|
@ -13,6 +13,9 @@ import com.brohoof.minelittlepony.renderer.PlaneRenderer;
|
|||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConstants {
|
||||
|
@ -41,8 +44,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
}
|
||||
|
||||
@Override
|
||||
public void animate(float move, float swing, float tick, float horz, float vert) {
|
||||
this.checkRainboom(swing);
|
||||
public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) {
|
||||
this.checkRainboom(entity, swing);
|
||||
this.rotateHead(horz, vert);
|
||||
this.swingTailZ(move, swing);
|
||||
float bodySwingRotation = 0.0F;
|
||||
|
@ -76,7 +79,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
this.bipedHeadwear.offsetZ = 0f;
|
||||
this.setLegs(move, swing, tick);
|
||||
this.holdItem();
|
||||
this.swingItem(this.swingProgress);
|
||||
this.swingItem(entity, this.swingProgress);
|
||||
if (this.isSneak && !this.isFlying) {
|
||||
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
this.sneakLegs();
|
||||
|
@ -111,7 +114,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
|
||||
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
this.swingArms(tick);
|
||||
this.swingArms(entity, tick);
|
||||
this.setHead(0.0F, 0.0F, 0.0F);
|
||||
|
||||
for (k1 = 0; k1 < tailstop; ++k1) {
|
||||
|
@ -158,8 +161,12 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
copyModelAngles(bipedBody, bipedBodyWear);
|
||||
}
|
||||
|
||||
protected void checkRainboom(float swing) {
|
||||
protected void checkRainboom(Entity entity, float swing) {
|
||||
this.rainboom = this.metadata.getRace() != null && this.metadata.getRace().hasWings() && this.isFlying && swing >= 0.9999F;
|
||||
|
||||
if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()) {
|
||||
this.rainboom = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected void setHead(float posX, float posY, float posZ) {
|
||||
|
@ -317,20 +324,40 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
protected void holdItem() {
|
||||
if (!this.rainboom && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() != 0)) {
|
||||
if (this.rightArmPose != ArmPose.EMPTY) {
|
||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - (float) Math.PI / 10F;
|
||||
this.steveRightArm.rotateAngleX = this.steveRightArm.rotateAngleX * 0.5F - (float) Math.PI / 10F;
|
||||
|
||||
switch (this.leftArmPose) {
|
||||
case EMPTY:
|
||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||
break;
|
||||
case BLOCK:
|
||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||
this.bipedLeftArm.rotateAngleY = 0.5235988F;
|
||||
break;
|
||||
case ITEM:
|
||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||
}
|
||||
if (this.leftArmPose != ArmPose.EMPTY) {
|
||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.05F - (float) Math.PI / 10F;
|
||||
this.steveLeftArm.rotateAngleX = this.steveLeftArm.rotateAngleX * 0.05F - (float) Math.PI / 10F;
|
||||
|
||||
switch (this.rightArmPose) {
|
||||
case EMPTY:
|
||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||
break;
|
||||
case BLOCK:
|
||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||
this.bipedRightArm.rotateAngleY = -0.5235988F;
|
||||
break;
|
||||
case ITEM:
|
||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void swingItem(float swingProgress) {
|
||||
protected void swingItem(Entity entity, float swingProgress) {
|
||||
if (swingProgress > -9990.0F && !this.isSleeping) {
|
||||
float f16 = 1.0F - swingProgress;
|
||||
f16 *= f16 * f16;
|
||||
|
@ -338,23 +365,29 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
float f22 = MathHelper.sin(f16 * 3.1415927F);
|
||||
float f28 = MathHelper.sin(swingProgress * 3.1415927F);
|
||||
float f33 = f28 * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
|
||||
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0 && this.rightArmPose != ArmPose.EMPTY) {
|
||||
EnumHandSide mainSide = this.getMainHand(entity);
|
||||
boolean mainRight = mainSide == EnumHandSide.RIGHT;
|
||||
ArmPose mainPose = mainRight ? this.rightArmPose : this.leftArmPose;
|
||||
if (this.metadata.getRace().hasHorn() && this.metadata.getGlowColor() != 0 && mainPose != ArmPose.EMPTY) {
|
||||
this.unicornarm.rotateAngleX = (float) (this.unicornarm.rotateAngleX - (f22 * 1.2D + f33));
|
||||
this.unicornarm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
||||
this.unicornarm.rotateAngleZ = f28 * -0.4F;
|
||||
} else {
|
||||
this.bipedRightArm.rotateAngleX = (float) (this.bipedRightArm.rotateAngleX - (f22 * 1.2D + f33));
|
||||
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
||||
this.bipedRightArm.rotateAngleZ = f28 * -0.4F;
|
||||
this.steveRightArm.rotateAngleX = (float) (this.steveRightArm.rotateAngleX - (f22 * 1.2D + f33));
|
||||
this.steveRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
||||
this.steveRightArm.rotateAngleZ = f28 * -0.4F;
|
||||
ModelRenderer bipedArm = this.getArmForSide(mainSide);
|
||||
ModelRenderer steveArm = mainRight ? this.steveRightArm : this.steveLeftArm;
|
||||
bipedArm.rotateAngleX = (float) (bipedArm.rotateAngleX - (f22 * 1.2D + f33));
|
||||
bipedArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
||||
bipedArm.rotateAngleZ = f28 * -0.4F;
|
||||
steveArm.rotateAngleX = (float) (steveArm.rotateAngleX - (f22 * 1.2D + f33));
|
||||
steveArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
||||
steveArm.rotateAngleZ = f28 * -0.4F;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void swingArms(float tick) {
|
||||
protected void swingArms(Entity entity, float tick) {
|
||||
|
||||
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
|
||||
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
float sinTickFactor = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
|
@ -459,7 +492,6 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
}
|
||||
|
||||
protected void aimBowPony(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||
// TODO test left arm
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) {
|
||||
this.bipedRightArm.rotateAngleZ = 0.0F;
|
||||
this.bipedRightArm.rotateAngleY = -0.06F + this.bipedHead.rotateAngleY;
|
||||
|
@ -475,17 +507,6 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
this.bipedLeftArm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
shiftRotationPoint(this.bipedLeftArm, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
// this.bipedRightArmwear.rotateAngleZ = 0.0F;
|
||||
// this.bipedRightArmwear.rotateAngleY = -0.06F +
|
||||
// this.bipedHead.rotateAngleY;
|
||||
// this.bipedRightArmwear.rotateAngleX = ROTATE_270 +
|
||||
// this.bipedHead.rotateAngleX;
|
||||
// this.bipedRightArmwear.rotateAngleZ += MathHelper.cos(tick * 0.09F) *
|
||||
// 0.05F + 0.05F;
|
||||
// this.bipedRightArmwear.rotateAngleX += MathHelper.sin(tick * 0.067F)
|
||||
// * 0.05F;
|
||||
// shiftRotationPoint(this.bipedRightArmwear, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
protected void aimBowUnicorn(float tick) {
|
||||
|
|
|
@ -12,10 +12,7 @@ public class ModelSkeletonPony extends ModelPlayerPony {
|
|||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float tick) {
|
||||
if (true){
|
||||
super.rotateLegs(move, swing, tick);
|
||||
return;
|
||||
}
|
||||
|
||||
float rightArmRotateAngleX;
|
||||
float leftArmRotateAngleX;
|
||||
float rightLegRotateAngleX;
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.brohoof.minelittlepony.model.pony;
|
|||
|
||||
import com.brohoof.minelittlepony.renderer.PlaneRenderer;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelVillagerPony extends ModelPlayerPony {
|
||||
|
@ -17,8 +18,8 @@ public class ModelVillagerPony extends ModelPlayerPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void animate(float move, float swing, float tick, float horz, float vert) {
|
||||
super.animate(move, swing, tick, horz, vert);
|
||||
public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) {
|
||||
super.animate(move, swing, tick, horz, vert, entity);
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
|
||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt_float(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.brohoof.minelittlepony.model.pony.ModelPlayerPony;
|
|||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelPonyArmor extends ModelPlayerPony {
|
||||
|
@ -24,8 +25,8 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void animate(float move, float swing, float tick, float horz, float vert) {
|
||||
this.checkRainboom(swing);
|
||||
public void animate(float move, float swing, float tick, float horz, float vert, Entity entity) {
|
||||
this.checkRainboom(entity, swing);
|
||||
this.rotateHead(horz, vert);
|
||||
float bodySwingRotation = 0.0F;
|
||||
if (this.swingProgress > -9990.0F && (!this.metadata.getRace().hasHorn() || this.metadata.getGlowColor() == 0)) {
|
||||
|
@ -42,7 +43,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
|||
this.extHead[1].offsetZ = 0f;
|
||||
this.setLegs(move, swing, tick);
|
||||
this.holdItem();
|
||||
this.swingItem(this.swingProgress);
|
||||
this.swingItem(entity, this.swingProgress);
|
||||
if (this.isSneak && !this.isFlying) {
|
||||
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
this.sneakLegs();
|
||||
|
@ -71,7 +72,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
|||
|
||||
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
this.swingArms(tick);
|
||||
this.swingArms(entity, tick);
|
||||
this.setHead(0.0F, 0.0F, 0.0F);
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
|||
if (isUnicorn) {
|
||||
GlStateManager.translate(isLeft ? -0.1F : 0.1F, 1, -.5);
|
||||
} else {
|
||||
GlStateManager.translate(isLeft ? -0.0625F : 0.0625F, 0.125F, -1.00F);
|
||||
GlStateManager.translate(0.0425F, 0.125F, -1.00F);
|
||||
}
|
||||
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.brohoof.minelittlepony.renderer.layer;
|
||||
|
||||
import com.brohoof.minelittlepony.ducks.IRenderPony;
|
||||
import com.brohoof.minelittlepony.model.AbstractPonyModel;
|
||||
import com.brohoof.minelittlepony.model.BodyPart;
|
||||
import com.brohoof.minelittlepony.model.ModelPonyElytra;
|
||||
import com.brohoof.minelittlepony.model.pony.ModelHumanPlayer;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerElytra;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
||||
|
||||
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
|
||||
private RenderPlayer renderPlayer;
|
||||
private ModelPonyElytra modelElytra = new ModelPonyElytra();
|
||||
|
||||
private LayerElytra elytra;
|
||||
|
||||
public LayerPonyElytra(RenderPlayer rp) {
|
||||
this.renderPlayer = rp;
|
||||
this.elytra = new LayerElytra(rp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(AbstractClientPlayer entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {
|
||||
|
||||
AbstractPonyModel model = ((IRenderPony) this.renderPlayer).getPony().getModel();
|
||||
if (model instanceof ModelHumanPlayer) {
|
||||
this.elytra.doRenderLayer(entity, swing, swingAmount, ticks, age, yaw, head, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.ELYTRA) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if (entity.isPlayerInfoSet() && entity.getLocationElytra() != null) {
|
||||
this.renderPlayer.bindTexture(entity.getLocationElytra());
|
||||
} else if (entity.hasPlayerInfo() && entity.getLocationCape() != null && entity.isWearing(EnumPlayerModelParts.CAPE)) {
|
||||
this.renderPlayer.bindTexture(entity.getLocationCape());
|
||||
} else {
|
||||
this.renderPlayer.bindTexture(TEXTURE_ELYTRA);
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0.0F, 0.25F, 0.125F);
|
||||
model.transform(BodyPart.BODY);
|
||||
this.modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
|
||||
this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
|
||||
|
||||
if (itemstack.isItemEnchanted()) {
|
||||
LayerArmorBase.renderEnchantedGlint(this.renderPlayer, entity, this.modelElytra, swing, swingAmount, ticks, age, yaw, head, scale);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue