mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Let the models define their heights
This commit is contained in:
parent
c74f05873e
commit
d9ef32cc3c
7 changed files with 36 additions and 7 deletions
|
@ -755,6 +755,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getModelHeight() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*
|
*
|
||||||
|
|
|
@ -81,6 +81,8 @@ public interface IModel extends ICapitated {
|
||||||
|
|
||||||
float getRiderYOffset();
|
float getRiderYOffset();
|
||||||
|
|
||||||
|
float getModelHeight();
|
||||||
|
|
||||||
default boolean isWearing(PonyWearable wearable) {
|
default boolean isWearing(PonyWearable wearable) {
|
||||||
return getMetadata().isWearing(wearable);
|
return getMetadata().isWearing(wearable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,11 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getModelHeight() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWingRotationFactor(float ticks) {
|
public float getWingRotationFactor(float ticks) {
|
||||||
return MathHelper.sin(ticks) + WING_ROT_Z_SNEAK;
|
return MathHelper.sin(ticks) + WING_ROT_Z_SNEAK;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.model.ModelMobPony;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||||
|
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
|
@ -13,9 +14,12 @@ public class ModelSkeletonPony extends ModelMobPony {
|
||||||
|
|
||||||
public boolean isUnicorn;
|
public boolean isUnicorn;
|
||||||
|
|
||||||
|
public boolean isWithered;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||||
isUnicorn = entity.getUniqueID().getLeastSignificantBits() % 3 != 0;
|
isUnicorn = entity.getUniqueID().getLeastSignificantBits() % 3 != 0;
|
||||||
|
isWithered = entity instanceof EntityWitherSkeleton;
|
||||||
|
|
||||||
rightArmPose = ArmPose.EMPTY;
|
rightArmPose = ArmPose.EMPTY;
|
||||||
leftArmPose = ArmPose.EMPTY;
|
leftArmPose = ArmPose.EMPTY;
|
||||||
|
@ -74,6 +78,11 @@ public class ModelSkeletonPony extends ModelMobPony {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getModelHeight() {
|
||||||
|
return isWithered ? 2.5F : 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getArmRotationY() {
|
protected float getArmRotationY() {
|
||||||
return 8;
|
return 8;
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class ModelVillagerPony extends ModelAlicorn {
|
||||||
private int profession;
|
private int profession;
|
||||||
|
|
||||||
public boolean special;
|
public boolean special;
|
||||||
|
public boolean special2;
|
||||||
|
|
||||||
public ModelVillagerPony() {
|
public ModelVillagerPony() {
|
||||||
super(false);
|
super(false);
|
||||||
|
@ -36,6 +37,7 @@ public class ModelVillagerPony extends ModelAlicorn {
|
||||||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||||
profession = getProfession(entity);
|
profession = getProfession(entity);
|
||||||
special = "Derpy".equals(entity.getCustomNameTag());
|
special = "Derpy".equals(entity.getCustomNameTag());
|
||||||
|
special2 = special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,11 +57,16 @@ public class ModelVillagerPony extends ModelAlicorn {
|
||||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
if (special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0) {
|
if (special2) {
|
||||||
muffin.renderPart(scale);
|
muffin.renderPart(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getModelHeight() {
|
||||||
|
return special2 ? 2.3F : 2;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWearing(PonyWearable wearable) {
|
public boolean isWearing(PonyWearable wearable) {
|
||||||
if (wearable == PonyWearable.SADDLE_BAGS) {
|
if (wearable == PonyWearable.SADDLE_BAGS) {
|
||||||
|
|
|
@ -81,6 +81,11 @@ public class ModelWitchPony extends ModelZebra {
|
||||||
return isChild;
|
return isChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getModelHeight() {
|
||||||
|
return 2.5F;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
|
@ -102,15 +102,11 @@ public class RenderPony<T extends EntityLivingBase> {
|
||||||
// We start by negating the height calculation done by mohjong.
|
// We start by negating the height calculation done by mohjong.
|
||||||
float y = -(entity.height + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
float y = -(entity.height + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||||
|
|
||||||
if (entity.isChild()) {
|
|
||||||
y += 0.5F;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then we add our own offsets.
|
// Then we add our own offsets.
|
||||||
y += entity.height * getScaleFactor() + 0.25F;
|
y += ponyModel.getModelHeight() * getScaleFactor() + 0.25F;
|
||||||
|
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
y -= 0.125F;
|
y -= 0.25F;
|
||||||
}
|
}
|
||||||
|
|
||||||
return initial + y;
|
return initial + y;
|
||||||
|
|
Loading…
Reference in a new issue