Skip to content
On this page

Fabric

LivingBehaviorEvent

top.katton.api.eventfabric/src/main/kotlin/top/katton/api/event/LivingBehaviorEvent.kt
Living entity behavior events for Fabric platform.

LivingBehaviorEvent

FabricObject
kotlin
@Suppress("unused")
object LivingBehaviorEvent

Living entity behavior events for Fabric platform.

This object provides events related to living entity behaviors including elytra flight, sleeping, animal taming, and baby spawning.

LivingBehaviorEvent.onElytraAllow

FabricProperty
kotlin
val onElytraAllow

Event triggered to check if an entity is allowed to use elytra.

Returns

true to allow elytra usage, false to deny.

LivingBehaviorEvent.onElytraCustom

FabricProperty
kotlin
val onElytraCustom

Event triggered to provide custom elytra flight behavior.

Returns

true if custom behavior is applied, false to use default.

LivingBehaviorEvent.onAllowSleeping

FabricProperty
kotlin
val onAllowSleeping

Event triggered to check if a player is allowed to sleep.

Returns

BedSleepingProblem if sleep is denied, null to allow.

LivingBehaviorEvent.onStartSleeping

FabricProperty
kotlin
val onStartSleeping

Event triggered when a player starts sleeping.

LivingBehaviorEvent.onStopSleeping

FabricProperty
kotlin
val onStopSleeping

Event triggered when a player stops sleeping.

LivingBehaviorEvent.onAllowBed

FabricProperty
kotlin
val onAllowBed

Event triggered to check if a player is allowed to use a bed.

Returns

EventResult indicating the result of the check.

LivingBehaviorEvent.onAllowNearbyMonsters

FabricProperty
kotlin
val onAllowNearbyMonsters

Event triggered to check if nearby monsters prevent sleeping.

Returns

EventResult indicating whether monsters should prevent sleep.

LivingBehaviorEvent.onAllowResettingTime

FabricProperty
kotlin
val onAllowResettingTime

Event triggered to check if time should reset after sleeping.

Returns

true to allow time reset, false to prevent it.

LivingBehaviorEvent.onModifySleepingDirection

FabricProperty
kotlin
val onModifySleepingDirection

Event triggered to modify the sleeping direction when entering a bed.

Returns

The modified direction for the player to face.

LivingBehaviorEvent.onAllowSettingSpawn

FabricProperty
kotlin
val onAllowSettingSpawn

Event triggered to check if spawn point should be set when sleeping.

Returns

true to allow setting spawn, false to prevent it.

LivingBehaviorEvent.onSetBedOccupationState

FabricProperty
kotlin
val onSetBedOccupationState

Event triggered to set the bed occupation state.

Returns

true if the state was handled, false for default behavior.

LivingBehaviorEvent.onModifyWakeUpPosition

FabricProperty
kotlin
val onModifyWakeUpPosition

Event triggered to modify the player's wake-up position.

Returns

The modified Vec3 wake-up position.

LivingBehaviorEvent.onPlayerWakeUp

FabricProperty
kotlin
@JvmField
@JvmField val onPlayerWakeUp

Event triggered when a player wakes up from sleeping.