Skip to main content
Version: Minecraft 26.2

dev.polymodloader.api.event.entity

Generated

This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.

TypeKindDescription
AllowDamageListenerfunctional interfaceListener for EntityEvents.ALLOW_DAMAGE.
DamageModifierfunctional interfaceListener for EntityEvents.MODIFY_DAMAGE.
DeathListenerfunctional interfaceListener for EntityEvents.DIED.
EntityEventsclassEntity events, fired on the server thread.
EntityJoinedWorldListenerfunctional interfaceListener for EntityEvents.JOINED_WORLD.

AllowDamageListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface AllowDamageListener

Listener for EntityEvents.ALLOW_DAMAGE.

allowDamage(LivingEntityView, DamageInfo)​

boolean allowDamage(LivingEntityView entity, DamageInfo damage)

Since 0.1.0-alpha.4 or earlier

Returns false to cancel the damage. Called on the server thread before armour applies.

ParameterTypeDescription
entityLivingEntityView—
damageDamageInfo—

Returns boolean

DamageModifier​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface DamageModifier

Listener for EntityEvents.MODIFY_DAMAGE.

modifyDamage(LivingEntityView, DamageInfo)​

float modifyDamage(LivingEntityView entity, DamageInfo damage)

Since 0.1.0-alpha.4 or earlier

Returns the damage to deal instead of damage.amount(); return it unchanged to keep it. Listeners run in registration order and each sees the previous result. A result of 0 or less cancels the damage.

ParameterTypeDescription
entityLivingEntityView—
damageDamageInfo—

Returns float

DeathListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface DeathListener

Listener for EntityEvents.DIED.

onDied(LivingEntityView, DamageInfo)​

void onDied(LivingEntityView entity, DamageInfo cause)

Since 0.1.0-alpha.4 or earlier

Called on the server thread when death starts, before drops.

ParameterTypeDescription
entityLivingEntityView—
causeDamageInfo—

EntityEvents​

class · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public final class EntityEvents

Entity events, fired on the server thread.

Constant or fieldTypeDescription
JOINED_WORLDEventKey<EntityJoinedWorldListener>An entity of any kind joins a server world: spawned, loaded with its chunk, or arriving from another dimension. Fabric API: ServerEntityEvents.ENTITY_LOAD; NeoForge: EntityJoinLevelEvent (not cancellable here).
ALLOW_DAMAGEEventKey<AllowDamageListener>A living entity is about to take damage; any listener returning false cancels it.
MODIFY_DAMAGEEventKey<DamageModifier>A living entity is about to take damage that no ALLOW_DAMAGE listener cancelled; listeners may change the amount. Armour and resistance apply to the result.
DIEDEventKey<DeathListener>A living entity died.

EntityJoinedWorldListener​

functional interface · Stability PREVIEW · Since 0.1.0-alpha.4 or earlier

public interface EntityJoinedWorldListener

Listener for EntityEvents.JOINED_WORLD.

onEntityJoinedWorld(EntityView, WorldView)​

void onEntityJoinedWorld(EntityView entity, WorldView world)

Since 0.1.0-alpha.4 or earlier

Called on the server thread while the world starts tracking the entity. Do not remove or move the entity from the listener; schedule such changes with WorldView.schedule. Keep it cheap: chunks full of entities load often.

ParameterTypeDescription
entityEntityViewthe entity, of any kind (players, mobs, items, projectiles); valid only during the call
worldWorldViewits world
Buy me a coffee