Modifier and Type | Interface and Description |
---|---|
static class |
EntityUniverse.EntityHit
The result of an intersection between a ray and an entity.
|
Modifier and Type | Method and Description |
---|---|
Optional<Entity> |
createEntity(DataContainer entityContainer)
Create an entity instance at the given position.
|
Optional<Entity> |
createEntity(DataContainer entityContainer,
com.flowpowered.math.vector.Vector3d position)
Create an entity instance at the given position.
|
Entity |
createEntity(EntityType type,
com.flowpowered.math.vector.Vector3d position)
Create an entity instance at the given position.
|
default Entity |
createEntity(EntityType type,
com.flowpowered.math.vector.Vector3i position)
Create an entity instance at the given position.
|
Entity |
createEntityNaturally(EntityType type,
com.flowpowered.math.vector.Vector3d position)
Create an entity instance at the given position with the default
equipment.
|
default Entity |
createEntityNaturally(EntityType type,
com.flowpowered.math.vector.Vector3i position)
Create an entity instance at the given position with the default
equipment.
|
Collection<Entity> |
getEntities()
Return a collection of entities contained within this universe, possibly
only returning entities only in loaded areas.
|
Collection<Entity> |
getEntities(Predicate<Entity> filter)
Return a collection of entities contained within this universe, possibly
only returning entities only in loaded areas.
|
Optional<Entity> |
getEntity(UUID uuid)
Gets the entity whose
UUID matches the provided id, possibly
returning no entity if the entity is not loaded or non-existent. |
default Set<Entity> |
getIntersectingEntities(AABB box)
Gets all the entities that intersect the bounding box, in no particular
order.
|
Set<Entity> |
getIntersectingEntities(AABB box,
Predicate<Entity> filter)
Gets all the entities that intersect the bounding box, in no particular
order, as long as the pass the given filter test.
|
default Set<EntityUniverse.EntityHit> |
getIntersectingEntities(Entity looker,
double distance)
Gets all the entities that are in the line of sight of the given entity,
up to a given distance.
|
default Set<EntityUniverse.EntityHit> |
getIntersectingEntities(Entity looker,
double distance,
Predicate<EntityUniverse.EntityHit> filter)
Gets all the entities that are in the line of sight of the given entity,
up to a given distance.
|
default Set<EntityUniverse.EntityHit> |
getIntersectingEntities(com.flowpowered.math.vector.Vector3d start,
com.flowpowered.math.vector.Vector3d end)
Gets all the entities that intersect the ray (by their bounding box)
The ray is defined by its start and end point.
|
default Set<EntityUniverse.EntityHit> |
getIntersectingEntities(com.flowpowered.math.vector.Vector3d start,
com.flowpowered.math.vector.Vector3d direction,
double distance)
Gets all the entities that intersect the ray (by their bounding box)
The ray is defined by its start, direction and distance.
|
Set<EntityUniverse.EntityHit> |
getIntersectingEntities(com.flowpowered.math.vector.Vector3d start,
com.flowpowered.math.vector.Vector3d direction,
double distance,
Predicate<EntityUniverse.EntityHit> filter)
Gets all the entities that intersect the ray (by their bounding box)
The ray is defined by its start, direction and distance.
|
Set<EntityUniverse.EntityHit> |
getIntersectingEntities(com.flowpowered.math.vector.Vector3d start,
com.flowpowered.math.vector.Vector3d end,
Predicate<EntityUniverse.EntityHit> filter)
Gets all the entities that intersect the ray (by their bounding box)
The ray is defined by its start and end point.
|
default Collection<Entity> |
getNearbyEntities(com.flowpowered.math.vector.Vector3d location,
double distance)
Return a collection of entities contained within
distance blocks
of the specified location. |
Optional<Entity> |
restoreSnapshot(EntitySnapshot snapshot,
com.flowpowered.math.vector.Vector3d position)
|
Collection<Entity> |
spawnEntities(Iterable<? extends Entity> entities)
Similar to
spawnEntity(Entity) except where multiple entities
can be attempted to be spawned. |
boolean |
spawnEntity(Entity entity)
Spawns an
Entity using the already set properties (extent,
position, rotation) and applicable DataManipulator s for spawning
the entity. |
Optional<Entity> getEntity(UUID uuid)
UUID
matches the provided id, possibly
returning no entity if the entity is not loaded or non-existent.
For world implementations, only some parts of the world is usually loaded, so this method may return no entity if the entity is not loaded.
uuid
- The unique idCollection<Entity> getEntities()
For world implementations, only some parts of the world is usually loaded, so this method will only return entities within those loaded parts.
Collection<Entity> getEntities(Predicate<Entity> filter)
Predicate
before being returned.
For world implementations, only some parts of the world is usually loaded, so this method will only return entities within those loaded parts.
filter
- The filter to apply to the returned entitiesdefault Collection<Entity> getNearbyEntities(com.flowpowered.math.vector.Vector3d location, double distance)
distance
blocks
of the specified location. This uses a sphere to test distances.
For world implementations, only some parts of the world is usually loaded, so this method will only return entities within those loaded parts.
location
- The location at the center of the search radiusdistance
- The search radiusEntity createEntity(EntityType type, com.flowpowered.math.vector.Vector3d position) throws IllegalArgumentException, IllegalStateException
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
type
- The typeposition
- The positionIllegalArgumentException
- If the position or entity type is not
valid to createIllegalStateException
- If a constructor cannot be founddefault Entity createEntity(EntityType type, com.flowpowered.math.vector.Vector3i position) throws IllegalArgumentException, IllegalStateException
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
type
- The typeposition
- The positionIllegalArgumentException
- If the position or entity type is not
valid to createIllegalStateException
- If a constructor cannot be foundOptional<Entity> createEntity(DataContainer entityContainer)
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
entityContainer
- The data container of the entityOptional<Entity> createEntity(DataContainer entityContainer, com.flowpowered.math.vector.Vector3d position)
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
entityContainer
- The data container of the entityposition
- The position of the entity to spawn atEntity createEntityNaturally(EntityType type, com.flowpowered.math.vector.Vector3d position) throws IllegalArgumentException, IllegalStateException
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
type
- The typeposition
- The positionIllegalArgumentException
- If the position or entity type is not
valid to createIllegalStateException
- If a constructor cannot be founddefault Entity createEntityNaturally(EntityType type, com.flowpowered.math.vector.Vector3i position) throws IllegalArgumentException, IllegalStateException
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
type
- The typeposition
- The positionIllegalArgumentException
- If the position or entity type is not
valid to createIllegalStateException
- If a constructor cannot be foundOptional<Entity> restoreSnapshot(EntitySnapshot snapshot, com.flowpowered.math.vector.Vector3d position)
Entity
from the provided
EntitySnapshot
at the provided Vector3d
position.
Creating an entity does not spawn the entity into the world. An entity
created means the entity can be spawned at the given location. If
Optional.empty()
was returned, the entity is not able to spawn at
the given location. Furthermore, this allows for the Entity
to be
customized further prior to traditional "ticking" and processing by core
systems.
snapshot
- The entity snapshot of the entityposition
- The position of the entity to spawn atboolean spawnEntity(Entity entity)
Entity
using the already set properties (extent,
position, rotation) and applicable DataManipulator
s for spawning
the entity.
The requirements involve that all necessary setup of states and data
is already preformed on the entity retrieved from the various
createEntity(EntityType,Vector3d)
methods. Calling this will
make the now-spawned entity able to be processed by various systems.
If the entity was unable to spawn, the entity is not removed, but it should be taken note that there can be many reasons for a failure.
entity
- The entity to spawnCollection<Entity> spawnEntities(Iterable<? extends Entity> entities)
spawnEntity(Entity)
except where multiple entities
can be attempted to be spawned.entities
- The created entities you wish to spawndefault Set<Entity> getIntersectingEntities(AABB box)
box
- The intersection boxSet<Entity> getIntersectingEntities(AABB box, Predicate<Entity> filter)
box
- The intersection boxfilter
- The filter testdefault Set<EntityUniverse.EntityHit> getIntersectingEntities(com.flowpowered.math.vector.Vector3d start, com.flowpowered.math.vector.Vector3d end)
start
- The start of the rayend
- The end of the raySet<EntityUniverse.EntityHit> getIntersectingEntities(com.flowpowered.math.vector.Vector3d start, com.flowpowered.math.vector.Vector3d end, Predicate<EntityUniverse.EntityHit> filter)
start
- The start of the rayend
- The end of the rayfilter
- The filter testdefault Set<EntityUniverse.EntityHit> getIntersectingEntities(Entity looker, double distance)
looker
- The looking entitydistance
- The distance of the ray (from the start)default Set<EntityUniverse.EntityHit> getIntersectingEntities(Entity looker, double distance, Predicate<EntityUniverse.EntityHit> filter)
looker
- The looking entitydistance
- The distance of the ray (from the start)filter
- The filter testdefault Set<EntityUniverse.EntityHit> getIntersectingEntities(com.flowpowered.math.vector.Vector3d start, com.flowpowered.math.vector.Vector3d direction, double distance)
start
- The start of the raydirection
- The direction of the raydistance
- The distance of the ray (from the start)Set<EntityUniverse.EntityHit> getIntersectingEntities(com.flowpowered.math.vector.Vector3d start, com.flowpowered.math.vector.Vector3d direction, double distance, Predicate<EntityUniverse.EntityHit> filter)
start
- The start of the raydirection
- The direction of the raydistance
- The distance of the ray (from the start)filter
- The filter test