mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 01:17:47 +01:00
Add entity eye height
This commit is contained in:
parent
2efefe25b3
commit
f829aea534
@ -57,8 +57,11 @@ public final class RelativeVec {
|
|||||||
* @return the location
|
* @return the location
|
||||||
*/
|
*/
|
||||||
public @NotNull Vec from(@Nullable Entity entity) {
|
public @NotNull Vec from(@Nullable Entity entity) {
|
||||||
final var entityPosition = entity != null ? entity.getPosition() : Pos.ZERO;
|
if (entity != null) {
|
||||||
return from(entityPosition);
|
return from(entity.getPosition().add(0, entity.getEyeHeight(), 0));
|
||||||
|
} else {
|
||||||
|
return from(Pos.ZERO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Vec fromSender(@Nullable CommandSender sender) {
|
public @NotNull Vec fromSender(@Nullable CommandSender sender) {
|
||||||
|
Loading…
Reference in New Issue
Block a user