Package net.minestom.server.entity
Class EntityCreature
java.lang.Object
net.minestom.server.entity.Entity
net.minestom.server.entity.LivingEntity
net.minestom.server.entity.EntityCreature
- All Implemented Interfaces:
Sound.Emitter
,HoverEventSource<HoverEvent.ShowEntity>
,Shape
,EntityAI
,NavigableEntity
,EventHandler<EntityEvent>
,EquipmentHandler
,PermissionHandler
,Snapshotable
,Taggable
,TagReadable
,TagWritable
,AcquirableSource<Entity>
,Tickable
,Schedulable
,Viewable
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minestom.server.entity.Entity
Entity.Pose
-
Field Summary
Fields inherited from class net.minestom.server.entity.LivingEntity
canPickupItem, expandedBoundingBox, invulnerable, isDead, itemPickupCooldown, lastDamage, PROTECTED_MODIFIERS
Fields inherited from class net.minestom.server.entity.Entity
boundingBox, collidesWithEntities, currentChunk, entityMeta, entityType, gravityTickCount, hasPhysics, instance, lastSyncedPosition, lastVelocityWasZero, metadata, onGround, position, preventBlockPlacement, previousPosition, removed, trackingUpdate, vehicle, velocity, viewEngine, viewers
-
Constructor Summary
ConstructorDescriptionEntityCreature
(@NotNull EntityType entityType) EntityCreature
(@NotNull EntityType entityType, @NotNull UUID uuid) Constructor which allows to specify an UUID. -
Method Summary
Modifier and TypeMethodDescription@NotNull Acquirable
<? extends EntityCreature> Obtains anAcquirable
.void
Calls aEntityAttackEvent
with this entity as the source andtarget
as the target.void
Calls aEntityAttackEvent
with this entity as the source andtarget
as the target.Gets the AI groups of this entity.@NotNull Navigator
int
Gets the kill animation delay before vanishing the entity.@Nullable Entity
Gets the entity target.void
kill()
Kills the entity, trigger theEntityDeathEvent
event.setInstance
(@NotNull Instance instance, @NotNull Pos spawnPosition) Changes the entity instance, i.e.void
setRemovalAnimationDelay
(int removalAnimationDelay) Changes the removal animation delay of the entity.void
Changes the entity target.void
update
(long time) Called each tick.Methods inherited from class net.minestom.server.entity.LivingEntity
canPickupItem, damage, damage, getArrowCount, getAttribute, getAttributes, getAttributeValue, getEquipment, getFireTicks, getHealth, getLastDamageSource, getLivingEntityMeta, getPropertiesPacket, getTargetBlockPosition, getTeam, heal, isDead, isFlyingWithElytra, isImmune, isInvulnerable, onAttributeChanged, refreshActiveHand, refreshIsDead, setArrowCount, setBoundingBox, setCanPickupItem, setEquipment, setFireTicks, setFlyingWithElytra, setHealth, setInvulnerable, setSprinting, setTeam, swingMainHand, swingMainHand, swingOffHand, swingOffHand, takeKnockback, updateEquipmentAttributes, updateNewViewer
Methods inherited from class net.minestom.server.entity.Entity
addEffect, addPassenger, addViewer, asHoverEvent, autoViewEntities, clearEffects, despawn, editEntityMeta, eventNode, generateId, getAcquirable, getActiveEffects, getAerodynamics, getAliveTicks, getAllPermissions, getAttachEntityPacket, getBoundingBox, getChunk, getCustomName, getDistance, getDistance, getDistanceSquared, getDistanceSquared, getEffect, getEffectLevel, getEntityId, getEntityMeta, getEntityType, getEyeHeight, getGravityTickCount, getInstance, getLeashedEntities, getLeashHolder, getLineOfSight, getLineOfSightEntity, getMetadataPacket, getPassengers, getPassengersPacket, getPose, getPosition, getPreviousPosition, getSynchronizationTicks, getUuid, getVehicle, getVelocity, getVelocityForPacket, getVelocityPacket, getViewers, hasEffect, hasEntityCollision, hasLineOfSight, hasLineOfSight, hasNoGravity, hasPassenger, hasPredictableViewers, hasVelocity, intersectBox, intersectBoxSwept, isActive, isAutoViewable, isCustomNameVisible, isGlowing, isInvisible, isOccluded, isOnFire, isOnGround, isRemoved, isSilent, isSneaking, isSprinting, lookAt, lookAt, movementTick, preventBlockPlacement, refreshCoordinate, refreshCurrentChunk, refreshPosition, refreshPosition, refreshPosition, relativeEnd, relativeStart, remove, remove, removeEffect, removePassenger, removeViewer, scheduleNextTick, scheduler, scheduleRemove, scheduleRemove, setAerodynamics, setAutoViewable, setAutoViewEntities, setBoundingBox, setCustomName, setCustomNameVisible, setGlowing, setInstance, setInstance, setInvisible, setLeashHolder, setNoGravity, setPose, setSilent, setSneaking, setSynchronizationTicks, setVelocity, setView, spawn, switchEntityType, synchronizeNextTick, synchronizePosition, tagHandler, teleport, teleport, teleport, tick, triggerStatus, updateCollisions, updateOldViewer, updatePose, updateSnapshot, updateViewableRule, updateViewableRule, updateViewerRule, updateViewerRule
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.entity.ai.EntityAI
addAIGroup, addAIGroup, aiTick
Methods inherited from interface net.minestom.server.inventory.EquipmentHandler
getBodyEquipment, getBoots, getChestplate, getEquipmentsPacket, getHelmet, getItemInHand, getItemInMainHand, getItemInOffHand, getLeggings, hasEquipment, setBodyEquipment, setBoots, setChestplate, setHelmet, setItemInHand, setItemInMainHand, setItemInOffHand, setLeggings, syncEquipment
Methods inherited from interface net.kyori.adventure.text.event.HoverEventSource
asHoverEvent
Methods inherited from interface net.minestom.server.permission.PermissionHandler
addPermission, getPermission, hasPermission, hasPermission, hasPermission, removePermission, removePermission
Methods inherited from interface net.minestom.server.collision.Shape
intersectEntity, isFaceFull
Methods inherited from interface net.minestom.server.tag.Taggable
getAndSetTag, getAndUpdateTag, getTag, hasTag, removeTag, setTag, updateAndGetTag, updateTag
Methods inherited from interface net.minestom.server.Viewable
getViewersAsAudience, getViewersAsAudiences, isViewer, sendPacketsToViewers, sendPacketsToViewers, sendPacketToViewers, sendPacketToViewersAndSelf
-
Constructor Details
-
EntityCreature
Constructor which allows to specify an UUID. Only use if you know what you are doing! -
EntityCreature
-
-
Method Details
-
update
public void update(long time) Description copied from class:Entity
Called each tick.- Overrides:
update
in classLivingEntity
- Parameters:
time
- time of the update in milliseconds
-
setInstance
public CompletableFuture<Void> setInstance(@NotNull @NotNull Instance instance, @NotNull @NotNull Pos spawnPosition) Description copied from class:Entity
Changes the entity instance, i.e. spawns it.- Overrides:
setInstance
in classEntity
- Parameters:
instance
- the new instance of the entityspawnPosition
- the spawn position for the entity.- Returns:
- a
CompletableFuture
called once the entity's instance has been set, this is due to chunks needing to load
-
kill
public void kill()Description copied from class:LivingEntity
Kills the entity, trigger theEntityDeathEvent
event.- Overrides:
kill
in classLivingEntity
-
getRemovalAnimationDelay
public int getRemovalAnimationDelay()Gets the kill animation delay before vanishing the entity.- Returns:
- the removal animation delay in milliseconds, 0 if not any
-
setRemovalAnimationDelay
public void setRemovalAnimationDelay(int removalAnimationDelay) Changes the removal animation delay of the entity.Testing shows that 1000 is the minimum value to display the death particles.
- Parameters:
removalAnimationDelay
- the new removal animation delay in milliseconds, 0 to remove it
-
getAIGroups
Description copied from interface:EntityAI
Gets the AI groups of this entity.- Specified by:
getAIGroups
in interfaceEntityAI
- Returns:
- a modifiable collection of AI groups of this entity.
-
getTarget
Gets the entity target.- Returns:
- the entity target, can be null if not any
-
setTarget
Changes the entity target.- Parameters:
target
- the new entity target, null to remove
-
attack
Calls aEntityAttackEvent
with this entity as the source andtarget
as the target.- Parameters:
target
- the entity targetswingHand
- true to swing the entity main hand, false otherwise
-
attack
Calls aEntityAttackEvent
with this entity as the source andtarget
as the target.This does not trigger the hand animation.
- Parameters:
target
- the entity target
-
acquirable
Description copied from interface:AcquirableSource
Obtains anAcquirable
. To safely perform operations on this object, the user must callAcquirable.sync(Consumer)
,Acquirable.async(Consumer)
, orAcquirable.lock()
(followed by a subsequent unlock) on the Acquirable instance.- Specified by:
acquirable
in interfaceAcquirableSource<Entity>
- Overrides:
acquirable
in classLivingEntity
- Returns:
- an Acquirable which can be used to synchronize access to this object
-