add removing
This commit is contained in:
parent
9a04858686
commit
d8bd671f20
1 changed files with 22 additions and 0 deletions
|
@ -105,6 +105,28 @@ public final class EntityLib {
|
||||||
return entitiesById.get(entityId);
|
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
|
* @param uuid the entity uuid
|
||||||
* @return the entity with the given uuid, or null if an entity with that uuid does not exist
|
* @return the entity with the given uuid, or null if an entity with that uuid does not exist
|
||||||
|
|
Loading…
Reference in a new issue