From b1f7cda8cc5840f9200c8b3c7331ce9f233dcaaf Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 15 Jul 2019 09:37:43 +0200 Subject: [PATCH] Fixed various bugs with sneaking placement --- .../com/minelittlepony/client/model/ClientPonyModel.java | 8 +------- src/main/java/com/minelittlepony/client/pony/Pony.java | 2 +- .../java/com/minelittlepony/client/render/RenderPony.java | 2 +- .../client/render/entities/RenderPonyMob.java | 2 +- .../client/render/entities/player/RenderPonyPlayer.java | 2 +- .../client/render/layer/LayerHeldPonyItem.java | 2 +- .../minelittlepony/client/transform/PostureElytra.java | 2 +- 7 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index 01a5d120..aaced3da 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -40,13 +40,7 @@ public abstract class ClientPonyModel extends PlayerEnti @Override public void updateLivingState(T entity, IPony pony) { isChild = entity.isBaby(); - /*This was a bug, but I'm calling it a feature - * isSneaking = entity.isInSneakingPose() - *If a pony is able to get into a 1.5 tall gap whilst sneaking and releases the sneak key, - *they will stop crouching. Vanilla behaviour would have them continue to crouch, but that - *would look weird, especially with winged pegasi and bat ponies. - */ - isSneaking = entity.isSneaking(); + isSneaking = entity.isInSneakingPose(); attributes.updateLivingState(entity, pony); } diff --git a/src/main/java/com/minelittlepony/client/pony/Pony.java b/src/main/java/com/minelittlepony/client/pony/Pony.java index e63d6807..07c50669 100644 --- a/src/main/java/com/minelittlepony/client/pony/Pony.java +++ b/src/main/java/com/minelittlepony/client/pony/Pony.java @@ -165,7 +165,7 @@ public class Pony implements IPony { @Override public boolean isCrouching(LivingEntity entity) { - boolean isSneak = entity.isSneaking(); + boolean isSneak = entity.isInSneakingPose(); boolean isFlying = isFlying(entity); boolean isSwimming = isSwimming(entity); diff --git a/src/main/java/com/minelittlepony/client/render/RenderPony.java b/src/main/java/com/minelittlepony/client/render/RenderPony.java index f8b35910..af24dfef 100644 --- a/src/main/java/com/minelittlepony/client/render/RenderPony.java +++ b/src/main/java/com/minelittlepony/client/render/RenderPony.java @@ -158,7 +158,7 @@ public class RenderPony & IPony public double getNamePlateYOffset(T entity, double initial) { // We start by negating the height calculation done by mahjong. - float y = -(entity.getHeight() + 0.5F - (entity.isSneaking() ? 0.25F : 0)); + float y = -(entity.getHeight() + 0.5F - (entity.isInSneakingPose() ? 0.25F : 0)); // Then we add our own offsets. y += getModel().getAttributes().visualHeight * getScaleFactor() + 0.25F; diff --git a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java index d98762b8..a2d8fa27 100644 --- a/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/client/render/entities/RenderPonyMob.java @@ -54,7 +54,7 @@ public abstract class RenderPonyMob pushMatrix(); renderArm(hand); - if (entity.isSneaking()) { + if (getMainModel().getAttributes().isCrouching) { translatef(0, 0.2F, 0); } diff --git a/src/main/java/com/minelittlepony/client/transform/PostureElytra.java b/src/main/java/com/minelittlepony/client/transform/PostureElytra.java index 7a5094b8..eebb7148 100644 --- a/src/main/java/com/minelittlepony/client/transform/PostureElytra.java +++ b/src/main/java/com/minelittlepony/client/transform/PostureElytra.java @@ -9,6 +9,6 @@ public class PostureElytra implements PonyPosture { @Override public void transform(IModel model, LivingEntity entity, double motionX, double motionY, double motionZ, float yaw, float ticks) { GlStateManager.rotatef(90, 1, 0, 0); - GlStateManager.translatef(0, entity.isSneaking() ? 0.2F : -1, 0); + GlStateManager.translatef(0, model.getAttributes().isCrouching ? 0.2F : -1, 0); } }