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,- ValueContainer
- All Known Subinterfaces:
- Aerial,- Ageable,- Agent,- Ambient,- Animal,- Aquatic,- AreaEffectCloud,- ArmorStand,- Arrow,- ArrowEntity,- Axolotl,- Bat,- Bee,- Blaze,- BlockOccupiedMinecart,- Boat,- Boss,- CarrierMinecart<M>,- Cat,- CaveSpider,- ChestMinecart,- Chicken,- ClientPlayer,- Cod,- CommandBlockMinecart,- ComplexLiving<T>,- ComplexLivingPart<P>,- Cow,- Creature,- Creeper,- DamagingProjectile,- Dolphin,- Donkey,- DragonFireball,- Drowned,- Egg,- ElderGuardian,- EndCrystal,- EnderDragon,- EnderDragonPart,- Enderman,- Endermite,- EnderPearl,- EntityTargetingProjectile,- Evoker,- EvokerFangs,- ExperienceBottle,- ExperienceOrb,- Explosive,- ExplosiveFireball,- EyeOfEnder,- FallingBlock,- FireballEntity,- FireworkRocket,- Fish,- FishingBobber,- Fox,- FurnaceMinecart,- FusedExplosive,- Ghast,- Giant,- GlowSquid,- Goat,- Golem,- Guardian,- Hanging,- Hoglin,- HopperMinecart,- Horse,- HorseLike,- Hostile,- Human,- Humanoid,- Husk,- Illager,- Illusioner,- IronGolem,- Item,- ItemFrame,- LeashKnot,- LightningBolt,- Living,- Llama,- LlamaLike,- LlamaSpit,- LocalPlayer,- MagmaCube,- Marker,- Minecart,- MinecartLike,- Monster,- Mooshroom,- Mule,- Ocelot,- PackHorse,- Painting,- Panda,- Parrot,- Patroller,- Phantom,- Pig,- Piglin,- PiglinBrute,- PiglinLike,- Pillager,- Player,- PolarBear,- Potion,- PrimedTNT,- Projectile,- Pufferfish,- Rabbit,- Raider,- Ranger,- Ravager,- RemotePlayer,- Salmon,- SchoolingFish,- ServerPlayer,- Sheep,- Shulker,- ShulkerBullet,- Silverfish,- Sittable,- Skeleton,- SkeletonHorse,- SkeletonLike,- Slime,- SmallFireball,- Snowball,- SnowGolem,- SpawnerMinecart,- SpectralArrow,- Spellcaster,- Spider,- Squid,- Stray,- Strider,- TameableAnimal,- TameableHorse,- TNTMinecart,- Trader,- TraderLlama,- Trident,- TropicalFish,- Turtle,- Vehicle,- Vex,- Villager,- Vindicator,- WanderingTrader,- WeatherEffect,- Witch,- Wither,- WitherSkeleton,- WitherSkull,- Wolf,- Zoglin,- Zombie,- ZombieHorse,- ZombieLike,- ZombieVillager,- ZombifiedPiglin
@DoNotStore
public interface Entity
extends Identifiable, HoverEventSource<HoverEvent.ShowEntity>, Locatable, EntityProjectileSource, Sound.Emitter, SerializableDataHolder.Mutable, RandomProvider
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 SummaryNested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolderDataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.MutableNested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolderSerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
- 
Method SummaryModifier and TypeMethodDescriptiondefault Value.Mutable<Integer>age()baseSize()Gets the entity's bounding box, usually for collisions and interaction.default booleanReturns whether this entity can see the providedEntity.copy()Creates a clone copy of thisCopyableDataHolderas a newCopyableDataHoldersuch that all theValues are safely duplicated to the new instance.Creates anEntityArchetypefor use withSchematics.Creates anEntitySnapshot.default Optional<Value.Mutable<UUID>>creator()default Optional<Value.Mutable<Component>>default Value.Mutable<Boolean>default booleandamage(double damage, Supplier<? extends DamageSource> damageSource) Damages thisEntitywith the givenDamageSource.booleandamage(double damage, DamageSource damageSource) Damages thisEntitywith the givenDamageSource.default Vector3dGets 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<Boolean>glowing()default Value.Mutable<Boolean>height()default Value.Mutable<Boolean>default Value.Mutable<Ticks>default Value.Mutable<Boolean>booleanisLoaded()Returns whether this entity is still loaded in a world/chunk.booleanReturns whether this entity has been removed.default Value.Mutable<Boolean>voidMakes the entity look at the specified target position.default Value.Mutable<Integer>maxAir()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>voidremove()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>booleansetLocation(ServerLocation location) Sets the location of this entity.booleansetLocationAndRotation(ServerLocation location, Vector3d rotation) Moves the entity to the specified location and sets the rotation.booleansetLocationAndRotation(ServerLocation location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) Moves the entity to the specified location and sets the rotation.booleansetPosition(Vector3d position) Sets the position of this entity.voidsetRotation(Vector3d rotation) Sets the rotation of this entity.voidSets the scale.booleansetTransform(Transform transform) Sets theTransform.default Value.Mutable<Boolean>silent()default Value.Mutable<Boolean>sneaking()default Value.Mutable<Boolean>default Optional<Value.Mutable<Double>>default booleantransferToWorld(ServerWorld world) Sets theServerLocationof this entity to theServerWorld's spawn point.booleantransferToWorld(ServerWorld world, Vector3d position) Sets theServerLocationof 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.MutablecopyFrom, 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, undoMethods inherited from interface org.spongepowered.api.data.persistence.DataSerializablecontentVersion, toContainerMethods inherited from interface net.kyori.adventure.text.event.HoverEventSourceasHoverEventMethods inherited from interface org.spongepowered.api.util.IdentifiableuniqueIdMethods inherited from interface org.spongepowered.api.world.LocatableblockPosition, location, serverLocation, worldMethods inherited from interface org.spongepowered.api.projectile.source.ProjectileSourcelaunchProjectile, launchProjectile, launchProjectile, launchProjectile, launchProjectileTo, launchProjectileToMethods inherited from interface org.spongepowered.api.util.RandomProviderrandomMethods inherited from interface org.spongepowered.api.data.SerializableDataHoldervalidateRawDataMethods inherited from interface org.spongepowered.api.data.SerializableDataHolder.MutablesetRawData
- 
Method Details- 
typeEntityType<?> type()Gets theEntityType.- Returns:
- The type
 
- 
createSnapshotEntitySnapshot createSnapshot()Creates anEntitySnapshot.- Returns:
- The snapshot
 
- 
copyEntity copy()Description copied from interface:CopyableDataHolderCreates a clone copy of thisCopyableDataHolderas a newCopyableDataHoldersuch that all theValues 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:
- copyin interface- CopyableDataHolder
- Specified by:
- copyin interface- SerializableDataHolder
- Specified by:
- copyin interface- SerializableDataHolder.Mutable
- Returns:
- The new copy
 
- 
createArchetypeEntityArchetype createArchetype()Creates anEntityArchetypefor use withSchematics.- Returns:
- The archetype
 
- 
positionVector3d position()Gets the position of this entity- Returns:
- The position of this entity
 
- 
setPositionSets the position of this entity.- Parameters:
- position- The position to set
- Returns:
- True if set, false if not
 
- 
setLocationSets the location of this entity.- Parameters:
- location- The location to set
- Returns:
- True if location was set successfully, false otherwise
 
- 
rotationVector3d rotation()Gets the rotation.The format of the rotation is represented by: x -> pitch,y -> yaw,z -> roll- Returns:
- The rotation
 
- 
setRotationSets 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
 
- 
directionGets the unit vector representing the direction of this entity.- Returns:
- The direction
 
- 
setLocationAndRotationMoves 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 set
- rotation- The rotation to set
- Returns:
- True if location was set successfully, false otherwise
 
- 
setLocationAndRotationboolean setLocationAndRotation(ServerLocation location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) Moves the entity to the specified location and sets the rotation.RelativePositionslisted 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 set
- rotation- The rotation to set
- relativePositions- The coordinates to set relatively
- Returns:
- True if location was set successfully, false otherwise
 
- 
scaleVector3d scale()Gets the scale.- Returns:
- The entity scale
 
- 
setScaleSets the scale.- Parameters:
- scale- The scale
 
- 
transformTransform transform()Gets theTransform.- Returns:
- The transform
 
- 
setTransformSets theTransform.- Parameters:
- transform- The transform to set
- Returns:
- True if the transform was set successfully, false if the transform couldn't be set
 
- 
transferToWorldSets theServerLocationof 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)
 
- 
transferToWorldSets theServerLocationof this entity to a new position in a world.- Parameters:
- world- The world to transfer to
- position- 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)
 
- 
boundingBoxGets 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
 
- 
isRemovedboolean isRemoved()Returns whether this entity has been removed.- Returns:
- True if this entity has been removed
 
- 
isLoadedboolean isLoaded()Returns whether this entity is still loaded in a world/chunk.- Returns:
- True if this entity is still loaded
 
- 
removevoid remove()Mark this entity for removal in the very near future, preferably within one game tick.
- 
damageDamages thisEntitywith the givenDamageSource.- Parameters:
- damage- The damage to deal
- damageSource- The cause of the damage
- Returns:
- True if damaging the entity was successful
 
- 
damageDamages thisEntitywith the givenDamageSource.- Parameters:
- damage- The damage to deal
- damageSource- The cause of the damage
- Returns:
- True if damaging the entity was successful
 
- 
nearbyEntitiesGets the nearby entities within the desired distance.- Parameters:
- distance- The distance
- Returns:
- The collection of nearby entities
- See Also:
 
- 
nearbyEntitiesdefault Collection<? extends Entity> nearbyEntities(double distance, Predicate<? super Entity> predicate) Gets the nearby entities that satisfy the desired predicate.- Parameters:
- distance- The distance
- predicate- The predicate to use
- Returns:
- The collection of entities
- See Also:
 
- 
canSeeReturns whether this entity can see the providedEntity.- Parameters:
- entity- The entity to check visibility for
- Returns:
- trueif this entity can see the provided entity
 
- 
lookAtMakes 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
 
- 
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
 
- 
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:
- asHoverEventin interface- HoverEventSource<HoverEvent.ShowEntity>
 
 
-