diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index b3b1f9ace..dfa7d4897 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -271,7 +271,7 @@ public class Entity implements Viewable, Tickable, Schedulable, Snapshotable, Ev } public boolean isOnGround() { - return onGround || EntityUtils.isOnGround(this) /* backup for levitating entities */; + return onGround; } /** diff --git a/src/main/java/net/minestom/server/utils/entity/EntityUtils.java b/src/main/java/net/minestom/server/utils/entity/EntityUtils.java index 43332bb68..4d2054519 100644 --- a/src/main/java/net/minestom/server/utils/entity/EntityUtils.java +++ b/src/main/java/net/minestom/server/utils/entity/EntityUtils.java @@ -30,22 +30,4 @@ public final class EntityUtils { private EntityUtils() { } - - public static boolean isOnGround(@NotNull Entity entity) { - final Chunk chunk = entity.getChunk(); - if (chunk == null) - return false; - final Pos entityPosition = entity.getPosition(); - // TODO: check entire bounding box - try { - final Block block; - synchronized (chunk) { - block = chunk.getBlock(entityPosition.sub(0, 1, 0)); - } - return block.isSolid(); - } catch (NullPointerException e) { - // Probably an entity at the border of an unloaded chunk - return false; - } - } } diff --git a/src/test/java/net/minestom/server/entity/EntityVelocityIntegrationTest.java b/src/test/java/net/minestom/server/entity/EntityVelocityIntegrationTest.java index f4a0c3e83..107d2335e 100644 --- a/src/test/java/net/minestom/server/entity/EntityVelocityIntegrationTest.java +++ b/src/test/java/net/minestom/server/entity/EntityVelocityIntegrationTest.java @@ -158,7 +158,10 @@ public class EntityVelocityIntegrationTest { // Only entities on the ground should ignore the default velocity. assertTrue(entity.hasVelocity()); - env.tick(); + // Tick entity so it falls on the ground + for (int i = 0; i < 5; i++) { + entity.tick(0); + } // Now that the entity is on the ground, it should no longer have a velocity. assertFalse(entity.hasVelocity());