diff --git a/src/test/java/net/minestom/server/entity/EntityRemovalIntegrationTest.java b/src/test/java/net/minestom/server/entity/EntityRemovalIntegrationTest.java index 6654536d9..7dea5a2d8 100644 --- a/src/test/java/net/minestom/server/entity/EntityRemovalIntegrationTest.java +++ b/src/test/java/net/minestom/server/entity/EntityRemovalIntegrationTest.java @@ -21,7 +21,7 @@ public class EntityRemovalIntegrationTest { var connection = env.createConnection(); connection.connect(instance, new Pos(0, 40, 0)).join(); - var entity = new TestEntity(2, TimeUnit.SERVER_TICK); + var entity = new Entity(EntityType.ZOMBIE); entity.setInstance(instance, new Pos(0, 40, 0)).join(); var tracker = connection.trackIncoming(DestroyEntitiesPacket.class); @@ -29,6 +29,18 @@ public class EntityRemovalIntegrationTest { tracker.assertSingle(packet -> assertEquals(List.of(entity.getEntityId()), packet.entityIds())); } + @Test + public void instanceRemoval(Env env) { + var instance = env.createFlatInstance(); + var entity = new Entity(EntityType.ZOMBIE); + entity.setInstance(instance, new Pos(0, 40, 0)).join(); + assertFalse(entity.isRemoved()); + + entity.remove(); + assertTrue(entity.isRemoved()); + assertFalse(instance.getEntities().contains(entity), "Entity must not be in the instance anymore"); + } + @Test public void tickTimedRemoval(Env env) throws InterruptedException { var instance = env.createFlatInstance();