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, CamelHusk, CarrierMinecart<M>, Cat, CaveSpider, Chargeable, ChestBoat, ChestMinecart, Chicken, ClientPlayer, Cod, CommandBlockMinecart, ComplexLiving<T>, ComplexLivingPart<P>, CopperGolem, Cow, Creaking, Creeper, Cushion, 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, HappyGhast, 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, Mannequin, Marker, Minecart, MinecartLike, Monster, Mooshroom, Mule, Nautilus, NautilusLike, Ocelot, OminousItemSpawner, Ownable, PackHorse, Painting, Panda, Parched, Parrot, PathfinderAgent, Patroller, Phantom, Pig, Piglin, PiglinBrute, PiglinLike, Pillager, Player, PolarBear, Potion, PrimedTNT, Projectile, Pufferfish, Rabbit, Raft, 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, ZombieNautilus, 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 DataHolder
DataHolder.Immutable<I>, DataHolder.MutableNested classes/interfaces inherited from interface RandomProvider
RandomProvider.SourceNested classes/interfaces inherited from interface SerializableDataHolder
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 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 voidfoo()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> 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 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> 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 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, undoMethods inherited from interface DataSerializable
contentVersion, toContainer, toViewMethods inherited from interface HoverEventSource
asHoverEventMethods inherited from interface Identifiable
uniqueIdMethods inherited from interface Locatable
blockPosition, location, serverLocation, worldMethods inherited from interface ProjectileSource
launchProjectile, launchProjectile, launchProjectile, launchProjectile, launchProjectileTo, launchProjectileToMethods inherited from interface RandomProvider
randomMethods inherited from interface SerializableDataHolder
validateRawDataMethods inherited from interface SerializableDataHolder.Mutable
setRawDataMethods inherited from interface TeamMember
teamRepresentationMethods inherited from interface ValueContainer
get, getDouble, getInt, getKeys, getLong, getOrElse, getOrNull, getValue, getValues, require, requireValue, streamKeys, streamValues, supports, supports
-
Method Details
-
type
-
createSnapshot
-
copy
Entity 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 interfaceCopyableDataHolder- Specified by:
copyin interfaceSerializableDataHolder- Specified by:
copyin interfaceSerializableDataHolder.Mutable- Returns:
- The new copy
-
createArchetype
EntityArchetype createArchetype()Creates anEntityArchetypefor use withSchematics.- Returns:
- The archetype
-
position
-
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.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 setrotation- The rotation to setrelativePositions- The coordinates to set relatively- Returns:
- True if location was set successfully, false otherwise
-
scale
-
setScale
-
transform
-
setTransform
-
transferToWorld
Sets 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)
-
transferToWorld
Sets theServerLocationof 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
-
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 thisEntitywith the givenDamageSource.- Parameters:
damage- The damage to dealdamageSource- The cause of the damage- Returns:
- True if damaging the entity was successful
-
damage
Damages thisEntitywith the givenDamageSource.- Parameters:
damage- The damage to dealdamageSource- The cause of the damage- Returns:
- True if damaging the entity was successful
-
foo
default void foo() -
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
-
lookAt
Makes the entity look at the specified target position.- Parameters:
targetPos- Position to target
-
displayName
- Returns:
- The display name of this entity
-
fallDistance
-
frozenTime
-
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
-
velocity
-
gravityAffected
- Returns:
- Whether this entity is affected by gravity
-
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
-
age
-
baseSize
-
eyeHeight
-
eyePosition
-
height
-
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
-
sprinting
- Returns:
- Whether the entity is sprinting
-
wet
-
maxAir
-
maxFrozenTime
-
remainingAir
-
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 interfaceHoverEventSource<HoverEvent.ShowEntity>
-
boundingBoxBaseSize
- Returns:
- The bounding box base size of the entity
-
boundingBoxHeight
- Returns:
- The bounding box height of the entity
-