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.
|
Optional<Entity> |
createEntity(EntityType type,
com.flowpowered.math.vector.Vector3d position)
Create an entity instance at the given position.
|
Optional<Entity> |
createEntity(EntityType type,
com.flowpowered.math.vector.Vector3i position)
Create an entity instance at the given position.
|
Collection<Entity> |
getEntities()
Return a collection of entities contained within this universe,
possibly only returning entities only in loaded areas.
|
Collection<Entity> |
getEntities(java.util.function.Predicate<Entity> filter)
Return a collection of entities contained within this universe,
possibly only returning entities only in loaded areas.
|
Optional<Entity> |
restoreSnapshot(EntitySnapshot snapshot,
com.flowpowered.math.vector.Vector3d position)
|
boolean |
spawnEntity(Entity entity,
Cause cause)
Spawns an
Entity using the already set properties (extent,
position, rotation) and applicable DataManipulator s with the
specified Cause for spawning the entity. |
Collection<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(java.util.function.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 entitiesOptional<Entity> createEntity(EntityType type, 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.
type
- The typeposition
- The positionOptional<Entity> createEntity(EntityType type, com.flowpowered.math.vector.Vector3i 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.
type
- The typeposition
- The positionOptional<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 atOptional<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, Cause cause)
Entity
using the already set properties (extent,
position, rotation) and applicable DataManipulator
s with the
specified Cause
for spawning the entity.
Note that for the
Cause
to be useful in the expected SpawnEntityEvent
,
a SpawnCause
should be provided in the Cause
for other
plugins to understand and have finer control over the event.
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 spawncause
- The cause for the entity spawn