Fixed floating changelings. Closes #204

This commit is contained in:
Sollace 2023-10-11 14:17:12 +01:00
parent 23cf8bd702
commit 427fc7d210
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -420,9 +420,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)) {
entity.setBodyYaw(attachDirection.asRotation());
entity.prevBodyYaw = attachDirection.asRotation();
} 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();
}
}
}
@ -480,7 +485,9 @@ 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()) {
return Optional.of(entity.getBlockPos());
if (isFaceClimbable(entity.getWorld(), entity.getBlockPos(), entity.getHorizontalFacing()) || canHangAt(entity.getBlockPos())) {
return Optional.of(entity.getBlockPos());
}
}
return super.chooseClimbingPos();
}