Class EntityCreature
java.lang.Object
net.minestom.server.entity.Entity
net.minestom.server.entity.LivingEntity
net.minestom.server.entity.EntityCreature
- All Implemented Interfaces:
Identified, Pointered, Sound.Emitter, HoverEventSource<HoverEvent.ShowEntity>, Shape, DataComponent.Holder, EntityAI, NavigableEntity, EventHandler<EntityEvent>, EquipmentHandler, Snapshotable, Taggable, TagReadable, TagWritable, AcquirableSource<Entity>, Tickable, Schedulable, Viewable
-
Field Summary
Fields inherited from class LivingEntity
canPickupItem, expandedBoundingBox, invulnerable, isDead, itemPickupCooldown, lastDamage, PROTECTED_MODIFIERSFields inherited from class Entity
boundingBox, collidesWithEntities, currentChunk, ENTITY_POINTERS_SUPPLIER, entityMeta, entityType, gravityTickCount, hasPhysics, headRotation, instance, lastSyncedPosition, lastVelocityWasZero, metadata, onGround, position, preventBlockPlacement, previousPosition, removed, trackingUpdate, vehicle, velocity, viewEngine, viewers -
Constructor Summary
ConstructorsConstructorDescriptionEntityCreature(EntityType entityType) EntityCreature(EntityType entityType, UUID uuid) Constructor which allows to specify an UUID. -
Method Summary
Modifier and TypeMethodDescriptionAcquirable<? extends EntityCreature> Obtains anAcquirable.voidCalls aEntityAttackEventwith this entity as the source andtargetas the target.voidCalls aEntityAttackEventwith this entity as the source andtargetas the target.Gets the AI groups of this entity.intGets the kill animation delay before vanishing the entity.Gets the entity target.voidkill()Kills the entity, trigger theEntityDeathEventevent.setInstance(Instance instance, Pos spawnPosition) Changes the entity instance, i.e.voidsetRemovalAnimationDelay(int removalAnimationDelay) Changes the removal animation delay of the entity.voidChanges the entity target.voidupdate(long time) Called each tick.Methods inherited from class LivingEntity
canPickupItem, damage, damage, enterBed, getArrowCount, getAttribute, getAttributes, getAttributeValue, getEquipment, getFireTicks, getHealth, getLastDamageSource, getLivingEntityMeta, getPropertiesPacket, getTargetBlockPosition, getTeam, heal, isDead, isFlyingWithElytra, isImmune, isInvulnerable, leaveBed, onAttributeChanged, refreshActiveHand, refreshIsDead, setArrowCount, setBoundingBox, setCanPickupItem, setEquipment, setFireTicks, setFlyingWithElytra, setHealth, setInvulnerable, setSprinting, setTeam, shouldSendAttributes, swingMainHand, swingMainHand, swingOffHand, swingOffHand, takeKnockback, updateEquipmentAttributes, updateNewViewerMethods inherited from class Entity
addEffect, addPassenger, addViewer, asHoverEvent, autoViewEntities, clearEffects, despawn, editEntityMeta, eventNode, generateId, get, getAcquirable, getActiveEffects, getAerodynamics, getAliveTicks, getAttachEntityPacket, getBoundingBox, getChunk, getCustomName, getDistance, getDistance, getDistanceSquared, getDistanceSquared, getEffect, getEffectLevel, getEntityId, getEntityMeta, getEntityType, getEyeHeight, getGravityTickCount, getHeadRotation, getInstance, getLeashedEntities, getLeashHolder, getLineOfSight, getLineOfSightEntity, getMetadataPacket, getPassengers, getPassengersPacket, getPose, getPosition, getPreviousPosition, getSpawnPacket, getSynchronizationTicks, getUuid, getVehicle, getVelocity, getVelocityForPacket, getVelocityPacket, getViewers, hasEffect, hasEntityCollision, hasLineOfSight, hasLineOfSight, hasNoGravity, hasPassenger, hasPredictableViewers, hasVelocity, identity, intersectBox, intersectBoxSwept, isActive, isAutoViewable, isCustomNameVisible, isGlowing, isInvisible, isOccluded, isOnFire, isOnGround, isRemoved, isSilent, isSneaking, isSprinting, lookAt, lookAt, movementTick, pointers, preventBlockPlacement, refreshCoordinate, refreshCurrentChunk, refreshPosition, refreshPosition, refreshPosition, relativeEnd, relativeStart, remove, remove, removeEffect, removePassenger, removeViewer, scheduleNextTick, scheduler, scheduleRemove, scheduleRemove, set, setAerodynamics, setAutoViewable, setAutoViewEntities, setBoundingBox, setCustomName, setCustomNameVisible, setGlowing, setInstance, setInstance, setInvisible, setLeashHolder, setNoGravity, setPose, setPositionInternal, setSilent, setSneaking, setSynchronizationTicks, setVelocity, setView, setView, spawn, switchEntityType, synchronizeNextTick, synchronizePosition, tagHandler, teleport, teleport, teleport, teleport, teleport, teleport, tick, triggerStatus, updateCollisions, updateOldViewer, updatePose, updateSnapshot, updateViewableRule, updateViewableRule, updateViewerRule, updateViewerRuleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataComponent.Holder
get, hasMethods inherited from interface EntityAI
addAIGroup, addAIGroup, aiTickMethods inherited from interface EquipmentHandler
getBodyEquipment, getBoots, getChestplate, getEquipmentsPacket, getHelmet, getItemInHand, getItemInMainHand, getItemInOffHand, getLeggings, hasEquipment, setBodyEquipment, setBoots, setChestplate, setHelmet, setItemInHand, setItemInMainHand, setItemInOffHand, setLeggings, syncEquipment, syncEquipmentMethods inherited from interface HoverEventSource
asHoverEventMethods inherited from interface Pointered
get, getOrDefault, getOrDefaultFromMethods inherited from interface Shape
intersectEntity, isFaceFullMethods inherited from interface Taggable
getAndSetTag, getAndUpdateTag, getTag, hasTag, removeTag, setTag, updateAndGetTag, updateTagMethods inherited from interface 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:EntityCalled each tick.- Overrides:
updatein classLivingEntity- Parameters:
time- time of the update in milliseconds. This may only be used as a delta and has no meaning in the real world
-
setInstance
Description copied from class:EntityChanges the entity instance, i.e. spawns it.- Overrides:
setInstancein classEntity- Parameters:
instance- the new instance of the entityspawnPosition- the spawn position for the entity.- Returns:
- a
CompletableFuturecalled once the entity's instance has been set, this is due to chunks needing to load
-
kill
public void kill()Description copied from class:LivingEntityKills the entity, trigger theEntityDeathEventevent.- Overrides:
killin 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:EntityAIGets the AI groups of this entity.- Specified by:
getAIGroupsin interfaceEntityAI- Returns:
- a modifiable collection of AI groups of this entity.
-
getTarget
-
setTarget
-
attack
Calls aEntityAttackEventwith this entity as the source andtargetas the target.- Parameters:
target- the entity targetswingHand- true to swing the entity main hand, false otherwise
-
attack
Calls aEntityAttackEventwith this entity as the source andtargetas the target.This does not trigger the hand animation.
- Parameters:
target- the entity target
-
acquirable
Description copied from interface:AcquirableSourceObtains anAcquirable. To safely perform operations on this object, the user must callAcquirable.sync(Consumer),Acquirable.applySync(Function), orAcquirable.lock()(followed by a subsequent unlock) on the Acquirable instance.- Specified by:
acquirablein interfaceAcquirableSource<Entity>- Overrides:
acquirablein classLivingEntity- Returns:
- an Acquirable which can be used to synchronize access to this object
-