Interface Entity
- All Superinterfaces:
HoverEventSource<HoverEvent.ShowEntity>, SchedulerSource, Sound.Emitter, Sound.Source.Provider
- All Known Subinterfaces:
Damageable, ItemEntity, LivingEntity, Mob, Player
public interface Entity
extends HoverEventSource<HoverEvent.ShowEntity>, Sound.Emitter, Sound.Source.Provider, SchedulerSource
Anything living in a
World: players, mobs, items, projectiles.
An entity is bound to the region thread owning its chunk. Read its state freely, but change it
from that thread, through SchedulerSource.execute(Runnable) when
needed.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault ChunkPoschunk()Returns the position of the chunk holding this entity.Returns the name shown for this entity, its custom name or its type name.intentityId()Returns the network identifier of this entity, unique while the server runs.booleanReturnstrueonce this entity has left its world for good.location()Returns the current position and orientation of this entity.voidremove()Removes this entity from its world for good.server()Returns the server this entity belongs to.default CompletableFuture<Boolean> teleport(double x, double y, double z) Teleports this entity within its current world, keeping its orientation.default CompletableFuture<Boolean> Teleports this entity to another entity, moving worlds when needed.Teleports this entity to the given location, moving it to the world of the location when that is not its current world.type()Returns the type of this entity.uuid()Returns the persistent identity of this entity.world()Returns the world this entity is in.Methods inherited from interface HoverEventSource
asHoverEvent, asHoverEventMethods inherited from interface SchedulerSource
execute, executeDelayed, isOwnedByCurrentThreadMethods inherited from interface Sound.Source.Provider
soundSource
-
Method Details
-
entityId
int entityId()Returns the network identifier of this entity, unique while the server runs.- Returns:
- the network identifier of this entity, unique while the server runs
- Since:
- 0.1.0
-
uuid
UUID uuid()Returns the persistent identity of this entity.- Returns:
- the persistent identity of this entity
- Since:
- 0.1.0
-
displayName
Component displayName()Returns the name shown for this entity, its custom name or its type name.- Returns:
- the name shown for this entity, its custom name or its type name
- Since:
- 0.1.0
-
type
-
world
World world()Returns the world this entity is in.- Returns:
- the world this entity is in
- Since:
- 0.1.0
-
location
Location location()Returns the current position and orientation of this entity.- Returns:
- the current position and orientation of this entity
- Since:
- 0.1.0
-
chunk
Returns the position of the chunk holding this entity.- Returns:
- the position of the chunk holding this entity
- Since:
- 0.1.0
-
server
Server server()Returns the server this entity belongs to.- Returns:
- the server this entity belongs to
- Since:
- 0.1.0
-
isRemoved
boolean isRemoved()Returnstrueonce this entity has left its world for good.- Returns:
trueonce this entity has left its world for good- Since:
- 0.1.0
-
remove
void remove()Removes this entity from its world for good.- Since:
- 0.1.0
-
teleport
Teleports this entity to the given location, moving it to the world of the location when that is not its current world.- Parameters:
location- the destination position and orientation- Returns:
- a future completing with
trueif the teleport happened,falseif it was refused (for example because the entity has been removed) - Since:
- 0.1.0
-
teleport
Teleports this entity within its current world, keeping its orientation.- Parameters:
x- the destination x coordinatey- the destination y coordinatez- the destination z coordinate- Returns:
- a future completing with
trueif the teleport happened,falseif it was refused - Since:
- 0.1.0
-
teleport
Teleports this entity to another entity, moving worlds when needed.- Parameters:
target- the entity to teleport to- Returns:
- a future completing with
trueif the teleport happened,falseif it was refused - Since:
- 0.1.0
-