From c90635bc8a2077a6babafff6b7fdc66307221fa7 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 13 Aug 2021 14:50:08 +0200 Subject: [PATCH] Allow items following players to cross the last little distance rather than slow down infinitely --- .../java/com/minelittlepony/unicopia/entity/ItemImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/ItemImpl.java b/src/main/java/com/minelittlepony/unicopia/entity/ItemImpl.java index aff9e5b6..042b432c 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/ItemImpl.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/ItemImpl.java @@ -82,7 +82,9 @@ public class ItemImpl implements Equine, Owned { .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)); }