EntityEvent base class.
EntityEvent Base Class
All entity events inherit from this class:Damage Events
EntityDamageEvent
EntityDamageEvent
CAUSE_CONTACT(0) - Contact with cactus, etc.CAUSE_ENTITY_ATTACK(1) - Entity melee attackCAUSE_PROJECTILE(2) - Projectile hitCAUSE_SUFFOCATION(3) - Suffocating in blocksCAUSE_FALL(4) - Fall damageCAUSE_FIRE(5) - Standing in fireCAUSE_FIRE_TICK(6) - Being on fireCAUSE_LAVA(7) - Standing in lavaCAUSE_DROWNING(8) - DrowningCAUSE_BLOCK_EXPLOSION(9) - Block explosion (TNT)CAUSE_ENTITY_EXPLOSION(10) - Entity explosion (Creeper)CAUSE_VOID(11) - Void damageCAUSE_SUICIDE(12) - /kill commandCAUSE_MAGIC(13) - Magic/potion damageCAUSE_CUSTOM(14) - Custom damageCAUSE_STARVATION(15) - HungerCAUSE_FALLING_BLOCK(16) - Hit by falling block
MODIFIER_ARMOR(1) - Armor protectionMODIFIER_STRENGTH(2) - Strength effectMODIFIER_WEAKNESS(3) - Weakness effectMODIFIER_RESISTANCE(4) - Resistance effectMODIFIER_ABSORPTION(5) - Absorption heartsMODIFIER_ARMOR_ENCHANTMENTS(6) - Protection enchantmentsMODIFIER_CRITICAL(7) - Critical hitMODIFIER_TOTEM(8) - Totem of UndyingMODIFIER_WEAPON_ENCHANTMENTS(9) - Sharpness, etc.MODIFIER_PREVIOUS_DAMAGE_COOLDOWN(10) - Damage cooldownMODIFIER_ARMOR_HELMET(11) - Helmet specific
getCause()- Returns the damage causegetBaseDamage()- Returns base damage before modifierssetBaseDamage(float $damage)- Sets base damagegetOriginalBaseDamage()- Returns original base damagegetModifiers()- Returns all damage modifiersgetModifier(int $type)- Returns specific modifiersetModifier(float $damage, int $type)- Sets a modifierisApplicable(int $type)- Checks if modifier is applicablegetFinalDamage()- Returns final damage after modifierscanBeReducedByArmor()- Returns whether armor can reduce this damagegetAttackCooldown()- Returns attack cooldown in tickssetAttackCooldown(int $cooldown)- Sets attack cooldown
EntityDamageByEntityEvent
EntityDamageByEntityEvent
EntityDamageEvent.getDamager()- Returns the attacking entity (or null if dead)getKnockBack()- Returns knockback forcesetKnockBack(float $force)- Sets knockback forcegetVerticalKnockBackLimit()- Returns max upward velocitysetVerticalKnockBackLimit(float $limit)- Sets max upward velocity- All methods from
EntityDamageEvent
EntityDamageByChildEntityEvent
EntityDamageByChildEntityEvent
getChild()- Returns the child entity (e.g., arrow)- All methods from
EntityDamageByEntityEvent
EntityDamageByBlockEvent
EntityDamageByBlockEvent
getDamager()- Returns the damaging block- All methods from
EntityDamageEvent
Life Cycle Events
EntitySpawnEvent
EntitySpawnEvent
EntityDespawnEvent
EntityDespawnEvent
getEntityType()- Returns the EntityTypeInterface
EntityDeathEvent
EntityDeathEvent
getDrops()- Returns array of dropped itemssetDrops(array $drops)- Sets dropped itemsgetXpDropAmount()- Returns XP to dropsetXpDropAmount(int $amount)- Sets XP to drop
Movement Events
EntityTeleportEvent
EntityTeleportEvent
getFrom()- Returns origin positiongetTo()- Returns destination positionsetTo(Position $to)- Sets destination position
EntityMotionEvent
EntityMotionEvent
getVector()- Returns the motion vectorsetVector(Vector3 $motion)- Sets the motion vector
Status Effects
EntityEffectAddEvent
EntityEffectAddEvent
getEffect()- Returns the EffectInstancegetOldEffect()- Returns previous effect (or null)
EntityEffectRemoveEvent
EntityEffectRemoveEvent
getEffect()- Returns the EffectInstance being removed
Combat Events
EntityRegainHealthEvent
EntityRegainHealthEvent
CAUSE_SATURATION- Saturation effectCAUSE_EATING- Eating foodCAUSE_MAGIC- Instant Health potionCAUSE_REGEN- Regeneration effectCAUSE_CUSTOM- Custom healing
getAmount()- Returns health regainedsetAmount(float $amount)- Sets health regainedgetRegainReason()- Returns the cause
EntityShootBowEvent
EntityShootBowEvent
getBow()- Returns the bow itemgetProjectile()- Returns the projectile entitygetForce()- Returns shot force (0.0-1.0)
Combustion Events
EntityCombustEvent
EntityCombustEvent
getDuration()- Returns burn duration in secondssetDuration(int $duration)- Sets burn duration
EntityCombustByBlockEvent
EntityCombustByBlockEvent
getCombustor()- Returns the block causing combustion
EntityCombustByEntityEvent
EntityCombustByEntityEvent
getCombustor()- Returns the entity causing combustion
EntityExtinguishEvent
EntityExtinguishEvent
Explosion Events
EntityExplodeEvent
EntityExplodeEvent
getBlockList()- Returns blocks that will be destroyedsetBlockList(array $blocks)- Sets blocks to destroygetYieldDrops()- Returns whether blocks drop itemssetYieldDrops(bool $yield)- Sets whether blocks drop items
EntityPreExplodeEvent
EntityPreExplodeEvent
getAffectedBlocks()- Returns blocks that will be affectedsetAffectedBlocks(array $blocks)- Sets blocks to affect
Item Entity Events
ItemSpawnEvent
ItemSpawnEvent
ItemDespawnEvent
ItemDespawnEvent
ItemMergeEvent
ItemMergeEvent
getTarget()- Returns the other item entity
EntityItemPickupEvent
EntityItemPickupEvent
getOrigin()- Returns the item entitygetItem()- Returns the item stackgetInventory()- Returns the receiving inventory
Projectile Events
ProjectileLaunchEvent
ProjectileLaunchEvent
ProjectileHitEvent
ProjectileHitEvent
getRayTraceResult()- Returns the ray trace hit result
ProjectileHitBlockEvent
ProjectileHitBlockEvent
getBlockHit()- Returns the hit blockgetRayTraceResult()- Returns hit details
ProjectileHitEntityEvent
ProjectileHitEntityEvent
getEntityHit()- Returns the hit entitygetRayTraceResult()- Returns hit details
Special Events
EntityBlockChangeEvent
EntityBlockChangeEvent
getBlock()- Returns the affected blockgetTo()- Returns the new block state
EntityTrampleFarmlandEvent
EntityTrampleFarmlandEvent
getBlock()- Returns the farmland block
EntityFrostWalkerEvent
EntityFrostWalkerEvent
getBlockPositions()- Returns positions that will turn to ice
AreaEffectCloudApplyEvent
AreaEffectCloudApplyEvent
getRecipients()- Returns affected entitiessetRecipients(array $entities)- Sets affected entities