dev.polymodloader.api.event.entity
This page is generated from the source's Javadoc by ./gradlew apiReference. Do not edit it; fix the source comment and generate it again.
| Type | Kind | Description |
|---|---|---|
AllowDamageListener | functional interface | Listener for EntityEvents.ALLOW_DAMAGE. |
DamageModifier | functional interface | Listener for EntityEvents.MODIFY_DAMAGE. |
DeathListener | functional interface | Listener for EntityEvents.DIED. |
EntityEvents | class | Entity events, fired on the server thread. |
EntityJoinedWorldListener | functional interface | Listener 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.
| Parameter | Type | Description |
|---|---|---|
entity | LivingEntityView | — |
damage | DamageInfo | — |
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.
| Parameter | Type | Description |
|---|---|---|
entity | LivingEntityView | — |
damage | DamageInfo | — |
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.
| Parameter | Type | Description |
|---|---|---|
entity | LivingEntityView | — |
cause | DamageInfo | — |
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 field | Type | Description |
|---|---|---|
JOINED_WORLD | EventKey<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_DAMAGE | EventKey<AllowDamageListener> | A living entity is about to take damage; any listener returning false cancels it. |
MODIFY_DAMAGE | EventKey<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. |
DIED | EventKey<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.
| Parameter | Type | Description |
|---|---|---|
entity | EntityView | the entity, of any kind (players, mobs, items, projectiles); valid only during the call |
world | WorldView | its world |