From dee27bb5458d42cfe3533ae3699596e9c7d64aa4 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 26 Feb 2023 00:38:19 +0000 Subject: [PATCH] Fixed entities not positioned correctly in pegasi's arms --- .../minelittlepony/unicopia/client/minelittlepony/Main.java | 6 ++++++ .../unicopia/client/minelittlepony/MineLPDelegate.java | 4 ++++ .../unicopia/client/render/HeldEntityFeatureRenderer.java | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java index 8c4c32be..873d8c2a 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/Main.java @@ -79,6 +79,11 @@ public class Main extends MineLPDelegate implements ClientModInitializer { return IPony.getManager().getPony(entity).map(IPony::race).map(Main::toUnicopiaRace).orElse(Race.HUMAN); } + @Override + public float getPonyHeight(Entity entity) { + return super.getPonyHeight(entity) * IPony.getManager().getPony(entity).map(pony -> pony.metadata().getSize().getScaleFactor() + 0.1F).orElse(1F); + } + private static Race toUnicopiaRace(com.minelittlepony.api.pony.meta.Race race) { switch (race) { case ALICORN: @@ -97,6 +102,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer { return Race.BAT; case SEAPONY: case UNICORN: + case KIRIN: return Race.UNICORN; default: return Race.HUMAN; diff --git a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/MineLPDelegate.java b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/MineLPDelegate.java index 3acacde8..dd75ed82 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/MineLPDelegate.java +++ b/src/main/java/com/minelittlepony/unicopia/client/minelittlepony/MineLPDelegate.java @@ -29,6 +29,10 @@ public class MineLPDelegate { return Race.HUMAN; } + public float getPonyHeight(Entity entity) { + return entity.getHeight(); + } + public Race getRace(Entity entity) { return Race.HUMAN; } diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/HeldEntityFeatureRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/HeldEntityFeatureRenderer.java index 91e05127..b49a04cf 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/render/HeldEntityFeatureRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/client/render/HeldEntityFeatureRenderer.java @@ -99,12 +99,12 @@ public class HeldEntityFeatureRenderer implements Access } protected Vec3d getCarryPosition(Living entity, Living passenger) { - float passengerHeight = passenger.asEntity().getHeight() / 2F; + float passengerHeight = MineLPDelegate.getInstance().getPonyHeight(passenger.asEntity()) / 2F; float carrierHeight = entity.asEntity().getHeight() / 5F; if (entity instanceof Pony pony && MineLPDelegate.getInstance().getPlayerPonyRace(pony.asEntity()).isEquine() && pony.getPhysics().isFlying()) { return new Vec3d(0, - -passenger.asEntity().getHeight() - passengerHeight, + -carrierHeight * 10 - passengerHeight * 2, 0 ); }