Package org.spongepowered.api.entity
Interface Entity
- All Superinterfaces:
CopyableDataHolder
,DataHolder
,DataHolder.Mutable
,DataSerializable
,EntityProjectileSource
,HoverEventSource<HoverEvent.ShowEntity>
,Identifiable
,Locatable
,ProjectileSource
,RandomProvider
,SerializableDataHolder
,SerializableDataHolder.Mutable
,Sound.Emitter
,TeamMember
,ValueContainer
- All Known Subinterfaces:
AcceleratingProjectile
,Aerial
,Ageable
,Agent
,Allay
,Ambient
,Angerable
,Animal
,Aquatic
,AreaEffectCloud
,Armadillo
,ArmorStand
,Arrow
,ArrowLike
,Attackable
,Axolotl
,Bat
,Bee
,Blaze
,BlockDisplay
,BlockOccupiedMinecart
,Boat
,Bogged
,Boss
,Breedable
,Breeze
,BreezeWindCharge
,Camel
,CarrierMinecart<M>
,Cat
,CaveSpider
,Chargeable
,ChestBoat
,ChestMinecart
,Chicken
,ClientPlayer
,Cod
,CommandBlockMinecart
,ComplexLiving<T>
,ComplexLivingPart<P>
,Cow
,Creeper
,DisplayEntity
,Dolphin
,Donkey
,DragonFireball
,Drowned
,Egg
,ElderGuardian
,EndCrystal
,EnderDragon
,EnderDragonPart
,Enderman
,Endermite
,EnderPearl
,Evoker
,EvokerFangs
,ExperienceBottle
,ExperienceOrb
,Explosive
,ExplosiveFireball
,EyeOfEnder
,FallingBlock
,FireworkRocket
,Fish
,FishingBobber
,Fox
,Frog
,FurnaceMinecart
,FusedExplosive
,Ghast
,Giant
,GlowItemFrame
,GlowSquid
,Goat
,Golem
,Guardian
,Hanging
,Hoglin
,HopperMinecart
,Horse
,HorseLike
,Hostile
,Human
,Humanoid
,Husk
,IgnitingProjectile
,Illager
,Illusioner
,Interaction
,IronGolem
,Item
,ItemDisplay
,ItemFrame
,ItemRepresentable
,Leashable
,LeashKnot
,LightningBolt
,Living
,Llama
,LlamaSpit
,LocalPlayer
,MagmaCube
,Marker
,Minecart
,MinecartLike
,Monster
,Mooshroom
,Mule
,Ocelot
,OminousItemSpawner
,Ownable
,PackHorse
,Painting
,Panda
,Parrot
,PathfinderAgent
,Patroller
,Phantom
,Pig
,Piglin
,PiglinBrute
,PiglinLike
,Pillager
,Player
,PolarBear
,Potion
,PrimedTNT
,Projectile
,Pufferfish
,Rabbit
,Raider
,RangedAgent
,Ranger
,Ravager
,RemotePlayer
,Saddleable
,Salmon
,SchoolingFish
,ServerPlayer
,Sheep
,Shulker
,ShulkerBullet
,Silverfish
,Sittable
,Skeleton
,SkeletonHorse
,SkeletonLike
,Slime
,SmallFireball
,Sniffer
,Snowball
,SnowGolem
,SpawnerMinecart
,SpectralArrow
,Spellcaster
,Spider
,Squid
,Stray
,Strider
,Tadpole
,TameableAnimal
,Targeting
,TextDisplay
,ThrowableItemProjectile
,TNTMinecart
,TraderLlama
,Trident
,TropicalFish
,Turtle
,Vehicle
,Vex
,Villager
,VillagerLike
,Vindicator
,WanderingTrader
,Warden
,WindCharge
,WindChargeLike
,Witch
,Wither
,WitherSkeleton
,WitherSkull
,Wolf
,Zoglin
,Zombie
,ZombieHorse
,ZombieVillager
,ZombifiedPiglin
@DoNotStore
public interface Entity
extends Identifiable, HoverEventSource<HoverEvent.ShowEntity>, Locatable, EntityProjectileSource, Sound.Emitter, SerializableDataHolder.Mutable, RandomProvider, TeamMember
An entity is a Minecraft entity.
Examples of entities include:
- Zombies
- Sheep
- Players
- Dropped items
- Dropped experience points
- etc.
Blocks and items (when they are in inventories) are not entities.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
Nested classes/interfaces inherited from interface org.spongepowered.api.util.RandomProvider
RandomProvider.Source
Nested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
-
Method Summary
Modifier and TypeMethodDescriptiondefault Value.Mutable
<Integer> age()
baseSize()
Gets the entity's bounding box, usually for collisions and interaction.default Value.Mutable
<Double> default Value.Mutable
<Double> default boolean
Returns whether this entity can see the providedEntity
.copy()
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance.Creates anEntityArchetype
for use withSchematic
s.Creates anEntitySnapshot
.default Optional
<Value.Mutable<UUID>> creator()
default Optional
<Value.Mutable<Component>> default Value.Mutable
<Boolean> default boolean
damage
(double damage, Supplier<? extends DamageSource> damageSource) Damages thisEntity
with the givenDamageSource
.boolean
damage
(double damage, DamageSource damageSource) Damages thisEntity
with the givenDamageSource
.default Vector3d
Gets the unit vector representing the direction of this entity.default Value.Mutable
<Component> default Value.Mutable
<Double> default Value.Mutable
<Ticks> default Optional
<Value.Mutable<Ticks>> default Value.Mutable
<Ticks> default Value.Mutable
<Boolean> glowing()
default Value.Mutable
<Boolean> height()
default Value.Mutable
<Boolean> default Value.Mutable
<Ticks> default Value.Mutable
<Boolean> boolean
isLoaded()
Returns whether this entity is still loaded in a world/chunk.boolean
Returns whether this entity has been removed.default Value.Mutable
<Boolean> void
Makes the entity look at the specified target position.default Value.Mutable
<Integer> maxAir()
default Value.Mutable
<Ticks> default Collection
<? extends Entity> nearbyEntities
(double distance) Gets the nearby entities within the desired distance.default Collection
<? extends Entity> nearbyEntities
(double distance, Predicate<? super Entity> predicate) Gets the nearby entities that satisfy the desired predicate.default Optional
<Value.Mutable<UUID>> notifier()
onGround()
default ListValue.Mutable
<Entity> position()
Gets the position of this entitydefault Value.Mutable
<Integer> void
remove()
Mark this entity for removal in the very near future, preferably within one game tick.rotation()
Gets the rotation.scale()
Gets the scale.default SetValue.Mutable
<String> boolean
setLocation
(ServerLocation location) Sets the location of this entity.boolean
setLocationAndRotation
(ServerLocation location, Vector3d rotation) Moves the entity to the specified location and sets the rotation.boolean
setLocationAndRotation
(ServerLocation location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) Moves the entity to the specified location and sets the rotation.boolean
setPosition
(Vector3d position) Sets the position of this entity.void
setRotation
(Vector3d rotation) Sets the rotation of this entity.void
Sets the scale.boolean
setTransform
(Transform transform) Sets theTransform
.default Value.Mutable
<Boolean> silent()
default Value.Mutable
<Boolean> sneaking()
default Value.Mutable
<Boolean> default Optional
<Value.Mutable<Double>> default boolean
transferToWorld
(ServerWorld world) Sets theServerLocation
of this entity to theServerWorld
's spawn point.boolean
transferToWorld
(ServerWorld world, Vector3d position) Sets theServerLocation
of this entity to a new position in a world.Gets theTransform
.EntityType
<?> type()
Gets theEntityType
.default Value.Mutable
<VanishState> default Optional
<Value.Mutable<Entity>> vehicle()
default Value.Mutable
<Vector3d> velocity()
wet()
Methods inherited from interface org.spongepowered.api.data.DataHolder.Mutable
copyFrom, copyFrom, offer, offer, offer, offer, offerAll, offerAll, offerAll, offerAll, offerAll, offerAll, offerSingle, offerSingle, offerSingle, offerSingle, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeKey, removeKey, removeSingle, removeSingle, transform, transform, tryOffer, tryOffer, tryOffer, undo
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface org.spongepowered.api.util.Identifiable
uniqueId
Methods inherited from interface org.spongepowered.api.world.Locatable
blockPosition, location, serverLocation, world
Methods inherited from interface org.spongepowered.api.projectile.source.ProjectileSource
launchProjectile, launchProjectile, launchProjectile, launchProjectile, launchProjectileTo, launchProjectileTo
Methods inherited from interface org.spongepowered.api.util.RandomProvider
random
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Mutable
setRawData
Methods inherited from interface org.spongepowered.api.scoreboard.TeamMember
teamRepresentation
-
Method Details
-
type
EntityType<?> type()Gets theEntityType
.- Returns:
- The type
-
createSnapshot
EntitySnapshot createSnapshot()Creates anEntitySnapshot
.- Returns:
- The snapshot
-
copy
Entity copy()Description copied from interface:CopyableDataHolder
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance. It is not guaranteed that the returning container is of the same type as this container.- Specified by:
copy
in interfaceCopyableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder.Mutable
- Returns:
- The new copy
-
createArchetype
EntityArchetype createArchetype()Creates anEntityArchetype
for use withSchematic
s.- Returns:
- The archetype
-
position
Vector3d position()Gets the position of this entity- Returns:
- The position of this entity
-
setPosition
Sets the position of this entity.- Parameters:
position
- The position to set- Returns:
- True if set, false if not
-
setLocation
Sets the location of this entity.- Parameters:
location
- The location to set- Returns:
- True if location was set successfully, false otherwise
-
rotation
Vector3d rotation()Gets the rotation.The format of the rotation is represented by:
x -> pitch
,y -> yaw
,z -> roll
- Returns:
- The rotation
-
setRotation
Sets the rotation of this entity.The format of the rotation is represented by:
x -> pitch
,y -> yaw
,z -> roll
- Parameters:
rotation
- The rotation to set the entity to
-
direction
Gets the unit vector representing the direction of this entity.- Returns:
- The direction
-
setLocationAndRotation
Moves the entity to the specified location and sets the rotation.The format of the rotation is represented by:
x -> pitch
,y -> yaw
,z -> roll
- Parameters:
location
- The location to setrotation
- The rotation to set- Returns:
- True if location was set successfully, false otherwise
-
setLocationAndRotation
boolean setLocationAndRotation(ServerLocation location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) Moves the entity to the specified location and sets the rotation.RelativePositions
listed inside the EnumSet are considered relative.The format of the rotation is represented by:
x -> pitch
,y -> yaw
,z -> roll
- Parameters:
location
- The location to setrotation
- The rotation to setrelativePositions
- The coordinates to set relatively- Returns:
- True if location was set successfully, false otherwise
-
scale
Vector3d scale()Gets the scale.- Returns:
- The entity scale
-
setScale
Sets the scale.- Parameters:
scale
- The scale
-
transform
Transform transform()Gets theTransform
.- Returns:
- The transform
-
setTransform
Sets theTransform
.- Parameters:
transform
- The transform to set- Returns:
- True if the transform was set successfully, false if the transform couldn't be set
-
transferToWorld
Sets theServerLocation
of this entity to theServerWorld
's spawn point.- Parameters:
world
- The world to transfer to- Returns:
- Whether the transfer was successful, returns false if the action is cancelled or not possible (eg. because the entity has been removed)
-
transferToWorld
Sets theServerLocation
of this entity to a new position in a world.- Parameters:
world
- The world to transfer toposition
- The position in the target world- Returns:
- Whether the transfer was successful, returns false if the action is cancelled or not possible (eg. because the entity has been removed)
-
boundingBox
Gets the entity's bounding box, usually for collisions and interaction. The box has an offset matching the entity's positions. That is to say, it is absolutely positioned and not relative to the entity.- Returns:
- The axis aligned bounding box
-
isRemoved
boolean isRemoved()Returns whether this entity has been removed.- Returns:
- True if this entity has been removed
-
isLoaded
boolean isLoaded()Returns whether this entity is still loaded in a world/chunk.- Returns:
- True if this entity is still loaded
-
remove
void remove()Mark this entity for removal in the very near future, preferably within one game tick. -
damage
Damages thisEntity
with the givenDamageSource
.- Parameters:
damage
- The damage to dealdamageSource
- The cause of the damage- Returns:
- True if damaging the entity was successful
-
damage
Damages thisEntity
with the givenDamageSource
.- Parameters:
damage
- The damage to dealdamageSource
- The cause of the damage- Returns:
- True if damaging the entity was successful
-
nearbyEntities
Gets the nearby entities within the desired distance.- Parameters:
distance
- The distance- Returns:
- The collection of nearby entities
- See Also:
-
nearbyEntities
default Collection<? extends Entity> nearbyEntities(double distance, Predicate<? super Entity> predicate) Gets the nearby entities that satisfy the desired predicate.- Parameters:
distance
- The distancepredicate
- The predicate to use- Returns:
- The collection of entities
- See Also:
-
canSee
Returns whether this entity can see the providedEntity
.- Parameters:
entity
- The entity to check visibility for- Returns:
true
if this entity can see the provided entity
-
lookAt
Makes the entity look at the specified target position.- Parameters:
targetPos
- Position to target
-
displayName
- Returns:
- The display name of this entity
-
fallDistance
- Returns:
- The fall distance
-
frozenTime
- Returns:
- The frozen time
-
passengers
- Returns:
- The list of passengers that may be riding this entity
-
vehicle
- Returns:
- The vehicle this entity may be riding
-
baseVehicle
- Returns:
- The "base vehicle" of the entity vehicle riding chain
-
onGround
- Returns:
- Whether this entity is on the ground
-
velocity
- Returns:
- The velocity of this entity
-
gravityAffected
- Returns:
- Whether this entity is affected by gravity
-
silent
- Returns:
- Whether this entity is silent
-
creator
- Returns:
- The unique id of the creator of this entity
-
notifier
- Returns:
- The unique id of the notifier of this entity
-
fireTicks
- Returns:
- The amount of time in ticks the entity is will continue burn for
-
fireImmuneTicks
- Returns:
- The amount of time to delay in ticks before the entity will be burned by fire
-
isTransient
- Returns:
- The transient state
-
age
- Returns:
- The age of this entity
-
baseSize
- Returns:
- The base size of the entity
-
eyeHeight
- Returns:
- The height of the eyes
-
eyePosition
- Returns:
- The position of the eyes
-
height
- Returns:
- The height of the entity
-
invulnerabilityTicks
- Returns:
- The amount of ticks the entity will remain invulnerable for
-
customNameVisible
- Returns:
- Whether a custom name is visible on the entity
-
glowing
- Returns:
- Whether the entity has a glowing outline
-
invisible
- Returns:
- Whether the entity is currently invisible
-
invulnerable
- Returns:
- Whether the entity is invulnerable
-
sneaking
- Returns:
- Whether the entity is sneaking
-
sprinting
- Returns:
- Whether the entity is sprinting
-
wet
- Returns:
- Whether the entity is wet
-
maxAir
- Returns:
- The max air supply
-
maxFrozenTime
- Returns:
- The max frozen time
-
remainingAir
- Returns:
- The remaining air supply
-
scoreboardTags
- Returns:
- The scoreboard tags applied to the entity
-
vanishState
- Returns:
- The current vanish state of the entity
-
customName
- Returns:
- The custom name of the entity
-
swiftness
- Returns:
- The current swiftness of the entity
-
asHoverEvent
- Specified by:
asHoverEvent
in interfaceHoverEventSource<HoverEvent.ShowEntity>
-
boundingBoxBaseSize
- Returns:
- The bounding box base size of the entity
-
boundingBoxHeight
- Returns:
- The bounding box height of the entity
-