Fixed floating changelings. Closes #204

This commit is contained in:
Sollace 2023-10-11 14:17:12 +01:00
parent 309e39b583
commit 4953e11c54
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -432,9 +432,14 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
entity.setVelocity(entity.getVelocity().multiply(1, 0, 1));
entity.setSneaking(false);
}
} else if (attachDirection != null && isFaceClimbable(entity.getWorld(), entity.getBlockPos(), attachDirection)) {
} else if (attachDirection != null) {
if (isFaceClimbable(entity.getWorld(), entity.getBlockPos(), attachDirection)) {
entity.setBodyYaw(attachDirection.asRotation());
entity.prevBodyYaw = attachDirection.asRotation();
} else {
entity.setVelocity(vel);
entity.isClimbing();
}
}
}
@ -522,8 +527,10 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
@Override
public Optional<BlockPos> chooseClimbingPos() {
if (getObservedSpecies() == Race.CHANGELING && getSpellSlot().get(SpellPredicate.IS_DISGUISE, false).isEmpty()) {
if (isFaceClimbable(entity.getWorld(), entity.getBlockPos(), entity.getHorizontalFacing()) || canHangAt(entity.getBlockPos())) {
return Optional.of(entity.getBlockPos());
}
}
return super.chooseClimbingPos();
}