mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 11:50:36 +01:00
Verify entity removal from instance entity list
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
6f099a4036
commit
b5cc2c4126
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user