From bb16e157df2e79c70a5964e823813fbaf2b5ad27 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 8 Jul 2018 12:21:57 +0200 Subject: [PATCH] Fixed elytra floating off of foal's backs --- .../hdskins/gui/RenderPonyModel.java | 2 +- .../minelittlepony/model/AbstractPonyModel.java | 14 ++++++++++++-- .../minelittlepony/model/capabilities/IModel.java | 2 +- .../minelittlepony/model/ponies/ModelSeapony.java | 2 +- .../render/layer/LayerPonyElytra.java | 3 ++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java index 21b2e8c2..21f8514d 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java @@ -82,7 +82,7 @@ public class RenderPonyModel extends RenderPlayerModel { ModelBase model = renderingAsHuman ? modelElytra : ponyElytra; if (!renderingAsHuman) { - GlStateManager.translate(0, ((IModel)getMainModel()).getModelOffsetY(), 0.125F); + GlStateManager.translate(0, ((IModel)getMainModel()).getRiderYOffset(), 0.125F); } model.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index a5ab4375..3474a6bc 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -728,8 +728,18 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { } @Override - public float getModelOffsetY() { - return 0.25F; + public float getRiderYOffset() { + if (isChild()) { + return 1.05F; + } + + switch (getMetadata().getSize()) { + case NORMAL: return 0.4F; + case FOAL: return 1.05F; + case TALL: + case LARGE: + default: return 0.25F; + } } /** diff --git a/src/main/java/com/minelittlepony/model/capabilities/IModel.java b/src/main/java/com/minelittlepony/model/capabilities/IModel.java index 2281ac3a..12d2aec0 100644 --- a/src/main/java/com/minelittlepony/model/capabilities/IModel.java +++ b/src/main/java/com/minelittlepony/model/capabilities/IModel.java @@ -73,7 +73,7 @@ public interface IModel extends ICapitated { float getSwingAmount(); - float getModelOffsetY(); + float getRiderYOffset(); default boolean isWearing(PonyWearable wearable) { return getMetadata().isWearing(wearable); diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelSeapony.java b/src/main/java/com/minelittlepony/model/ponies/ModelSeapony.java index 8227b4aa..188a52ab 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelSeapony.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelSeapony.java @@ -133,7 +133,7 @@ public class ModelSeapony extends ModelUnicorn { } @Override - public float getModelOffsetY() { + public float getRiderYOffset() { return 1.05F; } diff --git a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java index 91718757..0057df20 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerPonyElytra.java @@ -35,8 +35,9 @@ public class LayerPonyElytra extends AbstractPonyLay getRenderer().bindTexture(getElytraTexture(entity)); GlStateManager.pushMatrix(); - GlStateManager.translate(0, getPlayerModel().getModelOffsetY(), 0.125F); + GlStateManager.translate(0, getPlayerModel().getRiderYOffset(), 0.125F); getPlayerModel().transform(BodyPart.BODY); + modelElytra.setRotationAngles(move, swing, ticks, yaw, head, scale, entity); modelElytra.render(entity, move, swing, ticks, yaw, head, scale);