mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 23:48:00 +01:00
More formatting
This commit is contained in:
parent
7a66dfda42
commit
c6e81529f3
5 changed files with 68 additions and 67 deletions
|
@ -1,53 +1,53 @@
|
||||||
package com.minelittlepony.model.components;
|
package com.minelittlepony.model.components;
|
||||||
|
|
||||||
import com.minelittlepony.model.PonyModelConstants;
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class PonyElytra extends ModelBase {
|
public class PonyElytra extends ModelBase {
|
||||||
private ModelRenderer rightWing;
|
private PonyRenderer rightWing = new PonyRenderer(this, 22, 0);
|
||||||
private ModelRenderer leftWing = new ModelRenderer(this, 22, 0);
|
private PonyRenderer leftWing = new PonyRenderer(this, 22, 0);
|
||||||
|
|
||||||
public PonyElytra() {
|
public PonyElytra() {
|
||||||
this.leftWing.addBox(-10.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
|
this.leftWing .box(-10, 0, 0, 10, 20, 2, 1);
|
||||||
this.rightWing = new ModelRenderer(this, 22, 0);
|
this.rightWing.mirror().box( 0, 0, 0, 10, 20, 2, 1);
|
||||||
this.rightWing.mirror = true;
|
|
||||||
this.rightWing.addBox(0.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Entity entityIn, float p_78088_2_, float limbSwing, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||||
GlStateManager.disableRescaleNormal();
|
GlStateManager.disableRescaleNormal();
|
||||||
GlStateManager.disableCull();
|
GlStateManager.disableCull();
|
||||||
this.leftWing.render(scale);
|
leftWing.render(scale);
|
||||||
this.rightWing.render(scale);
|
rightWing.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
|
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);
|
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
||||||
|
|
||||||
final float PI = (float) Math.PI;
|
final float PI = (float) Math.PI;
|
||||||
float rotateX = PI / 2F;
|
float rotateX = PI / 2F;
|
||||||
float rotateZ = PI / 12;
|
|
||||||
float rpY = PonyModelConstants.BODY_RP_Y_NOTSNEAK;
|
|
||||||
float rotateY = PI / 8F;
|
float rotateY = PI / 8F;
|
||||||
|
float rotateZ = PI / 12;
|
||||||
|
|
||||||
|
float rpY = PonyModelConstants.BODY_RP_Y_NOTSNEAK;
|
||||||
|
|
||||||
if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isElytraFlying()) {
|
if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isElytraFlying()) {
|
||||||
float f4 = 1.0F;
|
float f4 = 1;
|
||||||
|
|
||||||
if (entityIn.motionY < 0.0D) {
|
if (entityIn.motionY < 0) {
|
||||||
Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize();
|
Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize();
|
||||||
f4 = 1.0F - (float) Math.pow(-vec3d.y, 1.5D);
|
f4 = 1 - (float) Math.pow(-vec3d.y, 1.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateX = f4 * PI * (2 / 3F) + (1.0F - f4) * rotateX;
|
rotateX = f4 * PI * (2 / 3F) + (1 - f4) * rotateX;
|
||||||
rotateY = f4 * ((float) Math.PI / 2F) + (1.0F - f4) * rotateY;
|
rotateY = f4 * ((float) Math.PI / 2F) + (1 - f4) * rotateY;
|
||||||
} else if (entityIn.isSneaking()) {
|
} else if (entityIn.isSneaking()) {
|
||||||
rotateX = ((float) Math.PI * 1.175F);
|
rotateX = ((float) Math.PI * 1.175F);
|
||||||
rotateY = PI / 2;
|
rotateY = PI / 2;
|
||||||
|
@ -55,7 +55,7 @@ public class PonyElytra extends ModelBase {
|
||||||
rotateZ = PI / 4F;
|
rotateZ = PI / 4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.leftWing.rotationPointX = 5.0F;
|
this.leftWing.rotationPointX = 5;
|
||||||
this.leftWing.rotationPointY = rpY;
|
this.leftWing.rotationPointY = rpY;
|
||||||
|
|
||||||
if (entityIn instanceof AbstractClientPlayer) {
|
if (entityIn instanceof AbstractClientPlayer) {
|
||||||
|
|
|
@ -51,13 +51,13 @@ public class ModelIllagerPony extends ModelPlayerPony {
|
||||||
// this.bipedRightArm.rotationPointZ = 0.0F;
|
// this.bipedRightArm.rotationPointZ = 0.0F;
|
||||||
// this.bipedRightArm.rotationPointX = -5.0F;
|
// this.bipedRightArm.rotationPointX = -5.0F;
|
||||||
this.bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
|
this.bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
|
||||||
this.bipedRightArm.rotateAngleZ = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
|
this.bipedRightArm.rotateAngleZ = MathHelper.cos(ageInTicks * 0.6662F) / 4;
|
||||||
this.bipedRightArm.rotateAngleY = 1.1F;
|
this.bipedRightArm.rotateAngleY = 1.1F;
|
||||||
} else {
|
} else {
|
||||||
// this.bipedLeftArm.rotationPointZ = 0.0F;
|
// this.bipedLeftArm.rotationPointZ = 0.0F;
|
||||||
// this.bipedLeftArm.rotationPointX = 5.0F;
|
// this.bipedLeftArm.rotationPointX = 5.0F;
|
||||||
this.bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
|
this.bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
|
||||||
this.bipedLeftArm.rotateAngleZ = -MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
|
this.bipedLeftArm.rotateAngleZ = -MathHelper.cos(ageInTicks * 0.6662F) / 4;
|
||||||
this.bipedLeftArm.rotateAngleY = -1.1F;
|
this.bipedLeftArm.rotateAngleY = -1.1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
this.checkRainboom(entityIn, limbSwingAmount);
|
this.checkRainboom(entityIn, limbSwingAmount);
|
||||||
this.rotateHead(netHeadYaw, headPitch);
|
this.rotateHead(netHeadYaw, headPitch);
|
||||||
|
|
||||||
float bodySwingRotation = 0.0F;
|
float bodySwingRotation = 0;
|
||||||
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
if (swingProgress > -9990.0F && !metadata.hasMagic()) {
|
||||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.2F;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateLook(limbSwing, limbSwingAmount, bodySwingRotation, ageInTicks);
|
rotateLook(limbSwing, limbSwingAmount, bodySwingRotation, ageInTicks);
|
||||||
|
@ -184,7 +184,10 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
||||||
float leftArm, rightArm, leftLeg, rightLeg;
|
float leftArm;
|
||||||
|
float rightArm;
|
||||||
|
float leftLeg;
|
||||||
|
float rightLeg;
|
||||||
|
|
||||||
|
|
||||||
if (isFlying(entity)) {
|
if (isFlying(entity)) {
|
||||||
|
@ -196,11 +199,8 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
rightLeg = leftLeg = MathHelper.sin(swing / 2);
|
rightLeg = leftLeg = MathHelper.sin(swing / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bipedRightArm.rotateAngleY = 0.2F;
|
bipedLeftLeg.rotateAngleY = bipedRightArm.rotateAngleY = 0.2F;
|
||||||
bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F;
|
bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F;
|
||||||
|
|
||||||
bipedLeftLeg.rotateAngleY = 0.2F;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
float pi = PI * (float) Math.pow(swing, 16);
|
float pi = PI * (float) Math.pow(swing, 16);
|
||||||
|
|
||||||
|
@ -325,55 +325,55 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
|
|
||||||
if (mainPose == ArmPose.EMPTY) return;
|
if (mainPose == ArmPose.EMPTY) return;
|
||||||
|
|
||||||
float f16 = 1 - swingProgress;
|
|
||||||
f16 *= f16 * f16;
|
|
||||||
f16 = 1 - f16;
|
|
||||||
float f22 = MathHelper.sin(f16 * PI);
|
|
||||||
float f28 = MathHelper.sin(swingProgress * PI);
|
|
||||||
float f33 = f28 * (0.7F - bipedHead.rotateAngleX) * 0.75F;
|
|
||||||
|
|
||||||
if (metadata.hasMagic()) {
|
if (metadata.hasMagic()) {
|
||||||
swingArm(mainRight ? unicornArmRight : unicornArmLeft, f22, f33, f28);
|
swingArm(mainRight ? unicornArmRight : unicornArmLeft);
|
||||||
} else {
|
} else {
|
||||||
swingArm(getArmForSide(mainSide), f22, f33, f28);
|
swingArm(getArmForSide(mainSide));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swingArm(ModelRenderer arm, float f22, float f33, float f28) {
|
private void swingArm(ModelRenderer arm) {
|
||||||
arm.rotateAngleX = (float) (arm.rotateAngleX - (f22 * 1.2D + f33));
|
float swing = 1 - (float)Math.pow(1 - swingProgress, 3);
|
||||||
arm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
|
|
||||||
arm.rotateAngleZ = f28 * -0.4F;
|
float deltaX = MathHelper.sin(swing * PI);
|
||||||
|
float deltaZ = MathHelper.sin(swingProgress * PI);
|
||||||
|
|
||||||
|
float deltaAim = deltaZ * (0.7F - bipedHead.rotateAngleX) * 0.75F;
|
||||||
|
|
||||||
|
arm.rotateAngleX -= deltaAim + deltaX * 1.2F;
|
||||||
|
arm.rotateAngleZ = deltaZ * -0.4F;
|
||||||
|
arm.rotateAngleY += bipedBody.rotateAngleY * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void swingArms(float tick) {
|
protected void swingArms(float tick) {
|
||||||
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;
|
||||||
|
|
||||||
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
|
if (rightArmPose != ArmPose.EMPTY && !isSleeping) {
|
||||||
|
|
||||||
if (this.metadata.hasMagic()) {
|
if (metadata.hasMagic()) {
|
||||||
this.unicornArmRight.rotateAngleZ += cos;
|
unicornArmRight.rotateAngleZ += cos;
|
||||||
this.unicornArmRight.rotateAngleX += sin;
|
unicornArmRight.rotateAngleX += sin;
|
||||||
} else {
|
} else {
|
||||||
this.bipedRightArm.rotateAngleZ += cos;
|
bipedRightArm.rotateAngleZ += cos;
|
||||||
this.bipedRightArm.rotateAngleX += sin;
|
bipedRightArm.rotateAngleX += sin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.leftArmPose != ArmPose.EMPTY && !this.isSleeping) {
|
if (leftArmPose != ArmPose.EMPTY && !isSleeping) {
|
||||||
if (this.metadata.hasMagic()) {
|
if (metadata.hasMagic()) {
|
||||||
this.unicornArmLeft.rotateAngleZ += cos;
|
unicornArmLeft.rotateAngleZ += cos;
|
||||||
this.unicornArmLeft.rotateAngleX += sin;
|
unicornArmLeft.rotateAngleX += sin;
|
||||||
} else {
|
} else {
|
||||||
this.bipedLeftArm.rotateAngleZ += cos;
|
bipedLeftArm.rotateAngleZ += cos;
|
||||||
this.bipedLeftArm.rotateAngleX += sin;
|
bipedLeftArm.rotateAngleX += sin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
protected void adjustBody(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||||
this.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
|
adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
|
||||||
this.adjustNeck(rotateAngleX, rotationPointY, rotationPointZ);
|
adjustNeck(rotateAngleX, rotationPointY, rotationPointZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||||
|
@ -420,7 +420,7 @@ public class ModelPlayerPony 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 (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
||||||
|
|
||||||
if (this.metadata.hasMagic()) {
|
if (metadata.hasMagic()) {
|
||||||
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 {
|
} else {
|
||||||
|
|
|
@ -48,9 +48,9 @@ public class LayerPonyCustomHead implements LayerRenderer<EntityLivingBase> {
|
||||||
model.transform(BodyPart.HEAD);
|
model.transform(BodyPart.HEAD);
|
||||||
model.bipedHead.postRender(0.0625f);
|
model.bipedHead.postRender(0.0625f);
|
||||||
if (model instanceof ModelPlayerPony) {
|
if (model instanceof ModelPlayerPony) {
|
||||||
translate(0, .2, 0);
|
translate(0, 0.2F, 0);
|
||||||
} else {
|
} else {
|
||||||
translate(0, 0, .15);
|
translate(0, 0, 0.15F);
|
||||||
}
|
}
|
||||||
color(1, 1, 1, 1);
|
color(1, 1, 1, 1);
|
||||||
if (item == Items.SKULL) {
|
if (item == Items.SKULL) {
|
||||||
|
@ -65,26 +65,27 @@ public class LayerPonyCustomHead implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private void renderBlock(EntityLivingBase entity, ItemStack itemstack) {
|
private void renderBlock(EntityLivingBase entity, ItemStack itemstack) {
|
||||||
rotate(180, 0, 1, 0);
|
rotate(180, 0, 1, 0);
|
||||||
scale(0.625, -0.625, -0.625);
|
scale(0.625, -0.625F, -0.625F);
|
||||||
translate(0, 0.4, -0.21);
|
translate(0, 0.4F, -0.21F);
|
||||||
|
|
||||||
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, itemstack, TransformType.HEAD);
|
Minecraft.getMinecraft().getItemRenderer().renderItem(entity, itemstack, TransformType.HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderSkull(ItemStack itemstack, boolean isVillager, float limbSwing) {
|
private void renderSkull(ItemStack itemstack, boolean isVillager, float limbSwing) {
|
||||||
translate(0, 0, -.14);
|
translate(0, 0, -0.14F);
|
||||||
float f = 1.1875f;
|
float f = 1.1875f;
|
||||||
scale(f, -f, -f);
|
scale(f, -f, -f);
|
||||||
if (isVillager) {
|
if (isVillager) {
|
||||||
translate(0, 0.0625, 0);
|
translate(0, 0.0625F, 0);
|
||||||
}
|
}
|
||||||
translate(0, 0, -.05f);
|
translate(0, 0, -0.05F);
|
||||||
GameProfile profile = null;
|
GameProfile profile = null;
|
||||||
|
|
||||||
if (itemstack.hasTagCompound()) {
|
if (itemstack.hasTagCompound()) {
|
||||||
NBTTagCompound nbt = itemstack.getTagCompound();
|
NBTTagCompound nbt = itemstack.getTagCompound();
|
||||||
|
|
||||||
assert nbt != null;
|
assert nbt != null;
|
||||||
|
|
||||||
if (nbt.hasKey("SkullOwner", 10)) {
|
if (nbt.hasKey("SkullOwner", 10)) {
|
||||||
profile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner"));
|
profile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner"));
|
||||||
} else if (nbt.hasKey("SkullOwner", 8)) {
|
} else if (nbt.hasKey("SkullOwner", 8)) {
|
||||||
|
@ -93,7 +94,7 @@ public class LayerPonyCustomHead implements LayerRenderer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.45F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), profile, -1, limbSwing);
|
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0, -0.45F, EnumFacing.UP, 180, itemstack.getMetadata(), profile, -1, limbSwing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class LayerPonyElytra extends AbstractPonyLayer<EntityLivingBase> {
|
||||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||||
|
|
||||||
if (itemstack.getItem() == Items.ELYTRA) {
|
if (itemstack.getItem() == Items.ELYTRA) {
|
||||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlStateManager.color(1, 1, 1, 1);
|
||||||
|
|
||||||
if (entity instanceof AbstractClientPlayer) {
|
if (entity instanceof AbstractClientPlayer) {
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class LayerPonyElytra extends AbstractPonyLayer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(0.0F, 0.25F, 0.125F);
|
GlStateManager.translate(0, 0.25F, 0.125F);
|
||||||
model.transform(BodyPart.BODY);
|
model.transform(BodyPart.BODY);
|
||||||
this.modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
|
this.modelElytra.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
|
||||||
this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
|
this.modelElytra.render(entity, swing, swingAmount, age, yaw, head, scale);
|
||||||
|
|
Loading…
Reference in a new issue