From d5efe0d3f6e591aaa778b40d14ff51867a308d1f Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 28 Jul 2018 19:01:12 +0200 Subject: [PATCH] (reported by Poly) Fix head position and vertical alignment issues when sneaking --- .../voxelmodpack/hdskins/gui/RenderPlayerModel.java | 4 ++++ .../com/minelittlepony/model/AbstractPonyModel.java | 6 +++--- .../minelittlepony/transform/PonyTransformation.java | 11 ++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java index 809e0679..b7d5160a 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/gui/RenderPlayerModel.java @@ -108,6 +108,10 @@ public class RenderPlayerModel extends RenderLiving double offset = entity.getYOffset() + entity.posY + 0.01; + if (entity.isSneaking()) { + y -= 0.125D; + } + pushMatrix(); enableBlend(); color(1, 1, 1, 0.3F); diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index 6662964c..1ea98320 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -717,7 +717,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { @Override public boolean isChild() { - return metadata.getSize() == PonySize.FOAL || isChild; + return getSize() == PonySize.FOAL; } @Override @@ -737,7 +737,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { return 0.25F; } - switch (getMetadata().getSize()) { + switch (getSize()) { case NORMAL: return 0.4F; case FOAL: case TALL: @@ -834,7 +834,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { @Override public void transform(BodyPart part) { - if (isRiding) translate(0, -0.4F, -0.2F); + if (isRiding()) translate(0, -0.4F, -0.2F); if (isSleeping) { rotate(90, 1, 0, 0); diff --git a/src/main/java/com/minelittlepony/transform/PonyTransformation.java b/src/main/java/com/minelittlepony/transform/PonyTransformation.java index 7d84801b..ed370dfa 100644 --- a/src/main/java/com/minelittlepony/transform/PonyTransformation.java +++ b/src/main/java/com/minelittlepony/transform/PonyTransformation.java @@ -11,11 +11,16 @@ public enum PonyTransformation { NORMAL { @Override public void transform(IModel model, BodyPart part) { + if (model.isCrouching()) translate(0, -0.2F, 0); if (model.isSleeping()) translate(0, -0.61F, 0); switch (part) { case NECK: if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F); + break; + case HEAD: + if (model.isCrouching()) translate(0, 0.1F, 0); + break; default: } } @@ -23,6 +28,7 @@ public enum PonyTransformation { LARGE { @Override public void transform(IModel model, BodyPart part) { + if (model.isCrouching()) translate(0, -0.15F, 0); if (model.isSleeping()) translate(0, -0.98F, 0.2F); switch (part) { @@ -77,6 +83,7 @@ public enum PonyTransformation { TALL { @Override public void transform(IModel model, BodyPart part) { + if (model.isCrouching()) translate(0, -0.15F, 0); if (model.isSleeping()) translate(0, -0.5F, 0.25F); switch (part) { @@ -87,11 +94,9 @@ public enum PonyTransformation { break; case HEAD: translate(0, -0.15F, 0.01F); - if (model.isCrouching()) translate(0, 0.05F, 0); + if (model.isCrouching()) translate(0, 0.04F, 0); break; case BODY: - translate(0, -0.1F, 0); - break; case TAIL: translate(0, -0.1F, 0); break;