Fixed entities not positioned correctly in pegasi's arms

This commit is contained in:
Sollace 2023-02-26 00:38:19 +00:00
parent 1ef29e4eb5
commit dee27bb545
3 changed files with 12 additions and 2 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -99,12 +99,12 @@ public class HeldEntityFeatureRenderer<E extends LivingEntity> implements Access
}
protected Vec3d getCarryPosition(Living<E> 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
);
}