From f829aea5340f3e654999af8dc0da523b00dddf18 Mon Sep 17 00:00:00 2001 From: TheMode Date: Fri, 9 Jul 2021 19:28:08 +0200 Subject: [PATCH] Add entity eye height --- .../net/minestom/server/utils/location/RelativeVec.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/utils/location/RelativeVec.java b/src/main/java/net/minestom/server/utils/location/RelativeVec.java index e9a2ddffe..f48331a3c 100644 --- a/src/main/java/net/minestom/server/utils/location/RelativeVec.java +++ b/src/main/java/net/minestom/server/utils/location/RelativeVec.java @@ -57,8 +57,11 @@ public final class RelativeVec { * @return the location */ public @NotNull Vec from(@Nullable Entity entity) { - final var entityPosition = entity != null ? entity.getPosition() : Pos.ZERO; - return from(entityPosition); + if (entity != null) { + return from(entity.getPosition().add(0, entity.getEyeHeight(), 0)); + } else { + return from(Pos.ZERO); + } } public @NotNull Vec fromSender(@Nullable CommandSender sender) {