mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Allow items following players to cross the last little distance rather than slow down infinitely
This commit is contained in:
parent
5557e67a05
commit
c90635bc8a
1 changed files with 3 additions and 1 deletions
|
@ -82,7 +82,9 @@ public class ItemImpl implements Equine<ItemEntity>, Owned<ItemEntity> {
|
|||
.sorted((a, b) -> (int)(a.getPos().distanceTo(position) - b.getPos().distanceTo(position)))
|
||||
.findFirst()
|
||||
.ifPresent(player -> {
|
||||
owner.move(MovementType.SELF, player.getPos().subtract(owner.getPos()).multiply(clingy.getFollowSpeed(i)));
|
||||
double distance = player.getPos().distanceTo(owner.getPos());
|
||||
|
||||
owner.move(MovementType.SELF, player.getPos().subtract(owner.getPos()).multiply(distance < 0.3 ? 1 : clingy.getFollowSpeed(i)));
|
||||
if (owner.horizontalCollision) {
|
||||
owner.move(MovementType.SELF, new Vec3d(0, owner.verticalCollision ? -0.3 : 0.3, 0));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue