CommandSender
, Metadatable
, Nameable
, Permissible
, PersistentDataHolder
, ServerOperator
AbstractArrow
, AbstractHorse
, AbstractVillager
, Ageable
, Ambient
, Animals
, AreaEffectCloud
, ArmorStand
, Arrow
, Bat
, Bee
, Blaze
, Boat
, Boss
, Cat
, CaveSpider
, ChestedHorse
, Chicken
, Cod
, CommandMinecart
, ComplexEntityPart
, ComplexLivingEntity
, Cow
, Creature
, Creeper
, Damageable
, Dolphin
, Donkey
, DragonFireball
, Drowned
, Egg
, ElderGuardian
, EnderCrystal
, EnderDragon
, EnderDragonPart
, Enderman
, Endermite
, EnderPearl
, EnderSignal
, Evoker
, EvokerFangs
, ExperienceOrb
, Explosive
, ExplosiveMinecart
, FallingBlock
, Fireball
, Firework
, Fish
, FishHook
, Flying
, Fox
, Ghast
, Giant
, Golem
, Guardian
, Hanging
, HopperMinecart
, Horse
, HumanEntity
, Husk
, Illager
, Illusioner
, IronGolem
, Item
, ItemFrame
, LargeFireball
, LeashHitch
, LightningStrike
, LingeringPotion
, LivingEntity
, Llama
, LlamaSpit
, MagmaCube
, Minecart
, Mob
, Monster
, Mule
, MushroomCow
, NPC
, Ocelot
, Painting
, Panda
, Parrot
, Phantom
, Pig
, PigZombie
, Pillager
, Player
, PolarBear
, PoweredMinecart
, Projectile
, PufferFish
, Rabbit
, Raider
, RangedEntity
, Ravager
, RideableMinecart
, Salmon
, Sheep
, Shulker
, ShulkerBullet
, Silverfish
, SizedFireball
, Skeleton
, SkeletonHorse
, Slime
, SmallFireball
, Snowball
, Snowman
, SpawnerMinecart
, SpectralArrow
, Spellcaster
, Spider
, SplashPotion
, Squid
, StorageMinecart
, Stray
, Tameable
, ThrowableProjectile
, ThrownExpBottle
, ThrownPotion
, TippedArrow
, TNTPrimed
, TraderLlama
, Trident
, TropicalFish
, Turtle
, Vehicle
, Vex
, Villager
, Vindicator
, WanderingTrader
, WaterMob
, Witch
, Wither
, WitherSkeleton
, WitherSkull
, Wolf
, Zombie
, ZombieHorse
, ZombieVillager
public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder
Modifier and Type | Interface | Description |
---|---|---|
static class |
Entity.Spigot |
Modifier and Type | Method | Description |
---|---|---|
boolean |
addPassenger(@NotNull Entity passenger) |
Add a passenger to the vehicle.
|
boolean |
addScoreboardTag(@NotNull String tag) |
Add a tag to this entity.
|
boolean |
eject() |
Eject any passenger.
|
boolean |
fromMobSpawner() |
Returns whether this entity was spawned from a mob spawner.
|
@NotNull BoundingBox |
getBoundingBox() |
Gets the entity's current bounding box.
|
@NotNull Chunk |
getChunk() |
Gets the latest chunk an entity is currently or was in.
|
int |
getEntityId() |
Returns a unique id for this entity
|
CreatureSpawnEvent.SpawnReason |
getEntitySpawnReason() |
|
@NotNull BlockFace |
getFacing() |
Get the closest cardinal
BlockFace direction an entity is
currently facing. |
float |
getFallDistance() |
Returns the distance this entity has fallen
|
int |
getFireTicks() |
Returns the entity's current fire ticks (ticks before the entity stops
being on fire).
|
double |
getHeight() |
Gets the entity's height
|
@Nullable EntityDamageEvent |
getLastDamageCause() |
Retrieve the last
EntityDamageEvent inflicted on this entity. |
@NotNull Location |
getLocation() |
|
@Nullable Location |
getLocation(@Nullable Location loc) |
Stores the entity's current position in the provided Location object.
|
int |
getMaxFireTicks() |
Returns the entity's maximum fire ticks.
|
@NotNull List<Entity> |
getNearbyEntities(double x,
double y,
double z) |
Returns a list of entities within a bounding box centered around this
entity
|
@Nullable Location |
getOrigin() |
Gets the location where this entity originates from.
|
@Nullable Entity |
getPassenger() |
Deprecated.
entities may have multiple passengers, use
getPassengers() |
@NotNull List<Entity> |
getPassengers() |
Gets a list of passengers of this vehicle.
|
@NotNull PistonMoveReaction |
getPistonMoveReaction() |
Returns the reaction of the entity when moved by a piston.
|
int |
getPortalCooldown() |
Gets the period of time (in ticks) before this entity can use a portal.
|
@NotNull Pose |
getPose() |
Gets the entity's current pose.
|
@NotNull Set<String> |
getScoreboardTags() |
Returns a set of tags for this entity.
|
@NotNull Server |
getServer() |
Gets the
Server that contains this Entity |
int |
getTicksLived() |
Gets the amount of ticks this entity has lived for.
|
@NotNull EntityType |
getType() |
Get the type of the entity.
|
@NotNull UUID |
getUniqueId() |
Returns a unique and persistent id for this entity
|
@Nullable Entity |
getVehicle() |
Get the vehicle that this player is inside.
|
@NotNull Vector |
getVelocity() |
Gets this entity's current velocity
|
double |
getWidth() |
Gets the entity's width
|
@NotNull World |
getWorld() |
Gets the current world this entity resides in
|
boolean |
hasGravity() |
Returns whether gravity applies to this entity.
|
boolean |
isCustomNameVisible() |
Gets whether or not the mob's custom name is displayed client side.
|
boolean |
isDead() |
Returns true if this entity has been marked for removal.
|
boolean |
isEmpty() |
Check if a vehicle has passengers.
|
boolean |
isGlowing() |
Gets whether the entity is glowing or not.
|
boolean |
isInsideVehicle() |
Returns whether this entity is inside a vehicle.
|
boolean |
isInvulnerable() |
Gets whether the entity is invulnerable or not.
|
boolean |
isOnGround() |
Returns true if the entity is supported by a block.
|
boolean |
isPersistent() |
Deprecated.
draft API
|
boolean |
isSilent() |
Gets whether the entity is silent or not.
|
boolean |
isValid() |
Returns false if the entity has died or been despawned for some other
reason.
|
boolean |
leaveVehicle() |
Leave the current vehicle.
|
void |
playEffect(@NotNull EntityEffect type) |
Performs the specified
EntityEffect for this entity. |
void |
remove() |
Mark the entity's removal.
|
boolean |
removePassenger(@NotNull Entity passenger) |
Remove a passenger from the vehicle.
|
boolean |
removeScoreboardTag(@NotNull String tag) |
Removes a given tag from this entity.
|
void |
setCustomNameVisible(boolean flag) |
Sets whether or not to display the mob's custom name client side.
|
void |
setFallDistance(float distance) |
Sets the fall distance for this entity
|
void |
setFireTicks(int ticks) |
Sets the entity's current fire ticks (ticks before the entity stops
being on fire).
|
void |
setGlowing(boolean flag) |
Sets whether the entity has a team colored (default: white) glow.
|
void |
setGravity(boolean gravity) |
Sets whether gravity applies to this entity.
|
void |
setInvulnerable(boolean flag) |
Sets whether the entity is invulnerable or not.
|
void |
setLastDamageCause(@Nullable EntityDamageEvent event) |
Record the last
EntityDamageEvent inflicted on this entity |
boolean |
setPassenger(@NotNull Entity passenger) |
Deprecated.
entities may have multiple passengers, use
getPassengers() |
void |
setPersistent(boolean persistent) |
Deprecated.
draft API
|
void |
setPortalCooldown(int cooldown) |
Sets the period of time (in ticks) before this entity can use a portal.
|
void |
setRotation(float yaw,
float pitch) |
Sets the entity's rotation.
|
void |
setSilent(boolean flag) |
Sets whether the entity is silent or not.
|
void |
setTicksLived(int value) |
Sets the amount of ticks this entity has lived for.
|
void |
setVelocity(@NotNull Vector velocity) |
Sets this entity's velocity
|
@NotNull Entity.Spigot |
spigot() |
|
boolean |
teleport(@NotNull Entity destination) |
Teleports this entity to the target Entity.
|
boolean |
teleport(@NotNull Entity destination,
@NotNull PlayerTeleportEvent.TeleportCause cause) |
Teleports this entity to the target Entity.
|
boolean |
teleport(@NotNull Location location) |
Teleports this entity to the given location.
|
boolean |
teleport(@NotNull Location location,
@NotNull PlayerTeleportEvent.TeleportCause cause) |
Teleports this entity to the given location.
|
default CompletableFuture<Boolean> |
teleportAsync(@NotNull Location loc) |
Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
|
default CompletableFuture<Boolean> |
teleportAsync(@NotNull Location loc,
@NotNull PlayerTeleportEvent.TeleportCause cause) |
Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
|
getName, sendMessage, sendMessage, sendMessage, sendMessage
getMetadata, hasMetadata, removeMetadata, setMetadata
getCustomName, setCustomName
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
getPersistentDataContainer
isOp, setOp
@NotNull @NotNull Location getLocation()
@Contract("null -> null; !null -> !null") @Nullable @Nullable Location getLocation(@Nullable @Nullable Location loc)
If the provided Location is null this method does nothing and returns null.
loc
- the location to copy intovoid setVelocity(@NotNull @NotNull Vector velocity)
velocity
- New velocity to travel with@NotNull @NotNull Vector getVelocity()
double getHeight()
double getWidth()
@NotNull @NotNull BoundingBox getBoundingBox()
The returned bounding box reflects the entity's current location and size.
boolean isOnGround()
@NotNull @NotNull World getWorld()
void setRotation(float yaw, float pitch)
Note that if the entity is affected by AI, it may override this rotation.
yaw
- the yawpitch
- the pitchUnsupportedOperationException
- if used for playersboolean teleport(@NotNull @NotNull Location location)
location
- New location to teleport this entity totrue
if the teleport was successfulboolean teleport(@NotNull @NotNull Location location, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause)
location
- New location to teleport this entity tocause
- The cause of this teleportationtrue
if the teleport was successfulboolean teleport(@NotNull @NotNull Entity destination)
destination
- Entity to teleport this entity totrue
if the teleport was successfulboolean teleport(@NotNull @NotNull Entity destination, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause)
destination
- Entity to teleport this entity tocause
- The cause of this teleportationtrue
if the teleport was successful@NotNull default CompletableFuture<Boolean> teleportAsync(@NotNull @NotNull Location loc)
loc
- Location to teleport to@NotNull default CompletableFuture<Boolean> teleportAsync(@NotNull @NotNull Location loc, @NotNull @NotNull PlayerTeleportEvent.TeleportCause cause)
loc
- Location to teleport tocause
- Reason for teleport@NotNull @NotNull List<Entity> getNearbyEntities(double x, double y, double z)
x
- 1/2 the size of the box along x axisy
- 1/2 the size of the box along y axisz
- 1/2 the size of the box along z axisList<Entity>
List of entities nearbyint getEntityId()
int getFireTicks()
int getMaxFireTicks()
void setFireTicks(int ticks)
ticks
- Current ticks remainingvoid remove()
boolean isDead()
boolean isValid()
@NotNull @NotNull Server getServer()
Server
that contains this EntitygetServer
in interface CommandSender
@Deprecated boolean isPersistent()
By default all entities are persistent. An entity will also not get persisted, if it is riding an entity that is not persistent.
The persistent flag on players controls whether or not to save their playerdata file when they quit. If a player is directly or indirectly riding a non-persistent entity, the vehicle at the root and all its passengers won't get persisted.
This should not be confused with
LivingEntity.setRemoveWhenFarAway(boolean)
which controls
despawning of living entities.
@Deprecated void setPersistent(boolean persistent)
persistent
- the persistence statusisPersistent()
@Deprecated @Nullable @Nullable Entity getPassenger()
getPassengers()
@Deprecated boolean setPassenger(@NotNull @NotNull Entity passenger)
getPassengers()
passenger
- The new passenger.@NotNull @NotNull List<Entity> getPassengers()
The returned list will not be directly linked to the entity's current passengers, and no guarantees are made as to its mutability.
boolean addPassenger(@NotNull @NotNull Entity passenger)
passenger
- The passenger to addboolean removePassenger(@NotNull @NotNull Entity passenger)
passenger
- The passenger to removeboolean isEmpty()
boolean eject()
float getFallDistance()
void setFallDistance(float distance)
distance
- The new distance.void setLastDamageCause(@Nullable @Nullable EntityDamageEvent event)
EntityDamageEvent
inflicted on this entityevent
- a EntityDamageEvent
@Nullable @Nullable EntityDamageEvent getLastDamageCause()
EntityDamageEvent
inflicted on this entity.
This event may have been cancelled.EntityDamageEvent
or null if hitherto
unharmed@NotNull @NotNull UUID getUniqueId()
int getTicksLived()
This is the equivalent to "age" in entities.
void setTicksLived(int value)
This is the equivalent to "age" in entities. May not be less than one tick.
value
- Age of entityvoid playEffect(@NotNull @NotNull EntityEffect type)
EntityEffect
for this entity.
This will be viewable to all players near the entity.
If the effect is not applicable to this class of entity, it will not play.
type
- Effect to play.@NotNull @NotNull EntityType getType()
boolean isInsideVehicle()
boolean leaveVehicle()
@Nullable @Nullable Entity getVehicle()
void setCustomNameVisible(boolean flag)
This value has no effect on players, they will always display their name.
flag
- custom name or notboolean isCustomNameVisible()
This value has no effect on players, they will always display their name.
void setGlowing(boolean flag)
flag
- if the entity is glowingboolean isGlowing()
void setInvulnerable(boolean flag)
When an entity is invulnerable it can only be damaged by players in creative mode.
flag
- if the entity is invulnerableboolean isInvulnerable()
boolean isSilent()
void setSilent(boolean flag)
When an entity is silent it will not produce any sound.
flag
- if the entity is silentboolean hasGravity()
void setGravity(boolean gravity)
gravity
- whether gravity should applyint getPortalCooldown()
void setPortalCooldown(int cooldown)
cooldown
- portal cooldown ticks@NotNull @NotNull Set<String> getScoreboardTags()
boolean addScoreboardTag(@NotNull @NotNull String tag)
tag
- the tag to addboolean removeScoreboardTag(@NotNull @NotNull String tag)
tag
- the tag to remove@NotNull @NotNull PistonMoveReaction getPistonMoveReaction()
@NotNull @NotNull BlockFace getFacing()
BlockFace
direction an entity is
currently facing.
BlockFace.UP
or BlockFace.DOWN
.
Hanging
entities will override this call and thus their behavior
may be different.Hanging
,
Directional.getFacing()
@NotNull @NotNull Pose getPose()
Player.isSneaking()
being
true does not imply the current pose will be Pose.SNEAKING
@NotNull @NotNull Entity.Spigot spigot()
spigot
in interface CommandSender
@Nullable @Nullable Location getOrigin()
This value can be null if the entity hasn't yet been added to the world.
boolean fromMobSpawner()
@NotNull @NotNull Chunk getChunk()
@NotNull CreatureSpawnEvent.SpawnReason getEntitySpawnReason()
CreatureSpawnEvent.SpawnReason
that spawned this entity.Copyright © 2020. All rights reserved.