From 7da44b879c6bdf924a589b4e756342b337668ec7 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 9 Feb 2024 19:25:23 +0000 Subject: [PATCH] Fix various transformations for when a pony is lying down but not sleeping --- .../client/model/ClientPonyModel.java | 2 +- .../render/entity/feature/CapeFeature.java | 5 +++- .../client/transform/PonyTransformation.java | 23 ++++++++++++------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index 321e9f98..2caf39d8 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -51,7 +51,7 @@ public abstract class ClientPonyModel extends MsonPlayer child = entity.isBaby(); attributes.updateLivingState(entity, pony, mode); PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, mode); - sneaking = attributes.isCrouching; + sneaking = attributes.isCrouching && !attributes.isLyingDown; riding = attributes.isSitting; } diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java index 942443db..841a6d14 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/CapeFeature.java @@ -31,8 +31,11 @@ public class CapeFeature> stack.push(); - model.transform(BodyPart.BODY, stack); stack.translate(0, 0.24F, 0); + if (model.getAttributes().isLyingDown) { + stack.translate(0, -0.05F, 0); + } + model.transform(BodyPart.BODY, stack); model.getBodyPart(BodyPart.BODY).rotate(stack); double capeX = MathHelper.lerp(tickDelta, player.capeX, player.prevCapeX) - MathHelper.lerp(tickDelta, player.prevX, player.getX()); diff --git a/src/main/java/com/minelittlepony/client/transform/PonyTransformation.java b/src/main/java/com/minelittlepony/client/transform/PonyTransformation.java index 242d694b..dbdc2f8e 100644 --- a/src/main/java/com/minelittlepony/client/transform/PonyTransformation.java +++ b/src/main/java/com/minelittlepony/client/transform/PonyTransformation.java @@ -20,7 +20,8 @@ public enum PonyTransformation { public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isSwimming) stack.translate(0, -0.3F, 0); if (model.getAttributes().isCrouching) stack.translate(0, -0.2F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.61F, 0.1F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.77F, 0.1F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.16F, 0); if (model.getAttributes().isSitting) stack.translate(0, -0.2F, -0.2F); switch (part) { @@ -28,7 +29,8 @@ public enum PonyTransformation { if (model.getAttributes().isCrouching) stack.translate(-0.03F, 0.03F, 0.13F); break; case HEAD: - if (model.getAttributes().isCrouching) stack.translate(0, 0.1F, 0); + if (model.getAttributes().isLyingDown) stack.translate(-0.05F, -0.05F, 0); + if (model.getAttributes().isCrouching) stack.translate(0, 0.1F, -0); break; case BACK: translateForRider(stack); @@ -42,7 +44,8 @@ public enum PonyTransformation { public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isSwimming) stack.translate(0, -0.2F, 0); if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.6F, 0.15F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.68F, 0.15F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.08F, 0); if (model.getAttributes().isSitting) stack.translate(0, 0, -0.2F); switch (part) { @@ -77,7 +80,8 @@ public enum PonyTransformation { @Override public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.6F, 0.25F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.66F, 0.25F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.06F, 0); if (model.getAttributes().isSitting) stack.translate(0, 0, -0.2F); switch (part) { @@ -88,7 +92,7 @@ public enum PonyTransformation { break; case HEAD: stack.translate(0, -0.14F, -0.06F); - if (model.getAttributes().isLyingDown) stack.translate(0, 0, -0.1F); + if (model.getAttributes().isLyingDown) stack.translate(-0.05F, 0, -0.1F); if (model.getAttributes().isCrouching) stack.translate(0, 0.15F, 0); break; case BODY: @@ -113,7 +117,8 @@ public enum PonyTransformation { public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isSwimming) stack.translate(0, -0.9F, 0); if (model.getAttributes().isCrouching) stack.translate(0, -0.2F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.8F, -0.3F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.98F, -0.3F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.18F, 0); if (model.getAttributes().isSitting) stack.translate(0, -0.6F, -0.2F); stack.translate(0, 0.2F, 0); @@ -142,7 +147,8 @@ public enum PonyTransformation { @Override public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.5F, 0.35F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.6F, 0.35F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.1F, 0); if (model.getAttributes().isSitting) stack.translate(0, 0.1F, -0.2F); switch (part) { @@ -175,7 +181,8 @@ public enum PonyTransformation { public void transform(PonyModel model, BodyPart part, MatrixStack stack) { if (model.getAttributes().isSwimming) stack.translate(0, -0.6F, 0); if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0); - if (model.getAttributes().isLyingDown) stack.translate(0, -0.45F, -0.3F); + if (model.getAttributes().isLyingDown) stack.translate(0, -0.71F, -0.3F); + if (model.getAttributes().isSleeping) stack.translate(0, 0.26F, 0); if (model.getAttributes().isSitting) stack.translate(0, -0.4F, -0.2F); switch (part) {