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.
|
||||
*
|
||||
|
|
|
@ -81,6 +81,8 @@ public interface IModel extends ICapitated {
|
|||
|
||||
float getRiderYOffset();
|
||||
|
||||
float getModelHeight();
|
||||
|
||||
default boolean isWearing(PonyWearable wearable) {
|
||||
return getMetadata().isWearing(wearable);
|
||||
}
|
||||
|
|
|
@ -145,6 +145,11 @@ public class ModelEnderStallion extends ModelSkeletonPony {
|
|||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModelHeight() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWingRotationFactor(float ticks) {
|
||||
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.monster.AbstractSkeleton;
|
||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumHand;
|
||||
|
@ -13,9 +14,12 @@ public class ModelSkeletonPony extends ModelMobPony {
|
|||
|
||||
public boolean isUnicorn;
|
||||
|
||||
public boolean isWithered;
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||
isUnicorn = entity.getUniqueID().getLeastSignificantBits() % 3 != 0;
|
||||
isWithered = entity instanceof EntityWitherSkeleton;
|
||||
|
||||
rightArmPose = ArmPose.EMPTY;
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
|
@ -74,6 +78,11 @@ public class ModelSkeletonPony extends ModelMobPony {
|
|||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModelHeight() {
|
||||
return isWithered ? 2.5F : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getArmRotationY() {
|
||||
return 8;
|
||||
|
|
|
@ -20,6 +20,7 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
private int profession;
|
||||
|
||||
public boolean special;
|
||||
public boolean special2;
|
||||
|
||||
public ModelVillagerPony() {
|
||||
super(false);
|
||||
|
@ -36,6 +37,7 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
public void setLivingAnimations(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||
profession = getProfession(entity);
|
||||
special = "Derpy".equals(entity.getCustomNameTag());
|
||||
special2 = special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0;
|
||||
}
|
||||
|
||||
@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) {
|
||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (special && entity.getUniqueID().getLeastSignificantBits() % 20 == 0) {
|
||||
if (special2) {
|
||||
muffin.renderPart(scale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModelHeight() {
|
||||
return special2 ? 2.3F : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWearing(PonyWearable wearable) {
|
||||
if (wearable == PonyWearable.SADDLE_BAGS) {
|
||||
|
|
|
@ -81,6 +81,11 @@ public class ModelWitchPony extends ModelZebra {
|
|||
return isChild;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModelHeight() {
|
||||
return 2.5F;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
|
|
@ -102,15 +102,11 @@ public class RenderPony<T extends EntityLivingBase> {
|
|||
// We start by negating the height calculation done by mohjong.
|
||||
float y = -(entity.height + 0.5F - (entity.isSneaking() ? 0.25F : 0));
|
||||
|
||||
if (entity.isChild()) {
|
||||
y += 0.5F;
|
||||
}
|
||||
|
||||
// Then we add our own offsets.
|
||||
y += entity.height * getScaleFactor() + 0.25F;
|
||||
y += ponyModel.getModelHeight() * getScaleFactor() + 0.25F;
|
||||
|
||||
if (entity.isSneaking()) {
|
||||
y -= 0.125F;
|
||||
y -= 0.25F;
|
||||
}
|
||||
|
||||
return initial + y;
|
||||
|
|
Loading…
Reference in a new issue