add removing

This commit is contained in:
Tofaa 2024-02-11 23:06:17 +04:00
parent 9a04858686
commit d8bd671f20

View file

@ -105,6 +105,28 @@ public final class EntityLib {
return entitiesById.get(entityId);
}
/**
* Removes the entity completely from EntityLib and the platform.
* The viewer will no longer be able to see the entity.
*/
public static boolean removeEntity(int entityId) {
checkInit();
WrapperEntity e = entitiesById.get(entityId);
if (e == null) return false;
entities.remove(e.getUuid());
entitiesById.remove(entityId);
e.remove();
return true;
}
/**
* Removes the entity completely from EntityLib and the platform.
* The viewer will no longer be able to see the entity.
*/
public static boolean removeEntity(WrapperEntity entity) {
return removeEntity(entity.getEntityId());
}
/**
* @param uuid the entity uuid
* @return the entity with the given uuid, or null if an entity with that uuid does not exist