Interface Entity
- All Superinterfaces:
CommandSource, HoverEventSource<HoverEvent.ShowEntity>, SchedulerSource, Sound.Emitter, Sound.Source.Provider
- All Known Subinterfaces:
Damageable, LivingEntity, Mob, Player
public interface Entity
extends CommandSource, 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.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 within its current world.Teleports this entity to the given location, moving it toworldwhen that differs from 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 CommandSource
executor, sender, serverMethods 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.- Specified by:
locationin interfaceCommandSource- 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
-
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
-
teleport
Teleports this entity to the given location, moving it toworldwhen that differs from its current world.Cross-world teleports relocate the entity between worlds and, for players, trigger the client-side dimension change. The call is refused, completing with
false, when the entity is removed or the destination world cannot host it.- Parameters:
world- the destination worldlocation- the destination position and orientation- Returns:
- a future completing with
trueif the teleport happened,falseif it was refused - 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
-