Skip to content
On this page

NeoForge

LivingBehaviorEvent

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

LivingBehaviorEvent

NeoForgeObject
kotlin
@Suppress("unused")
@EventBusSubscriber( modid = Katton.MOD_ID, value = [Dist.DEDICATED_SERVER] )
modid

Living entity behavior events for NeoForge platform.

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

LivingBehaviorEvent.onAnimalTame

NeoForgeProperty
kotlin
val onAnimalTame

Event triggered when an animal is being tamed. Can be cancelled to prevent taming.

LivingBehaviorEvent.onBabySpawn

NeoForgeProperty
kotlin
val onBabySpawn

Event triggered when a baby entity is spawning (breeding). Can be cancelled to prevent the spawn.

LivingBehaviorEvent.onElytraAllow

NeoForgeProperty
kotlin
@JvmField
@JvmField 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

NeoForgeProperty
kotlin
@JvmField
@JvmField val onElytraCustom

Event triggered to provide custom elytra flight behavior.

Returns

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

LivingBehaviorEvent.onAllowSleeping

NeoForgeProperty
kotlin
@JvmField
@JvmField val onAllowSleeping

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

Returns

BedSleepingProblem if sleep is denied, null to allow.

LivingBehaviorEvent.onStartSleeping

NeoForgeProperty
kotlin
@JvmField
@JvmField val onStartSleeping

Event triggered when a player starts sleeping.

LivingBehaviorEvent.onStopSleeping

NeoForgeProperty
kotlin
@JvmField
@JvmField val onStopSleeping

Event triggered when a player stops sleeping.

LivingBehaviorEvent.onAllowBed

NeoForgeProperty
kotlin
@JvmField
@JvmField 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

NeoForgeProperty
kotlin
@JvmField
@JvmField val onAllowNearbyMonsters

Event triggered to check if nearby monsters prevent sleeping.

Returns

EventResult indicating whether monsters should prevent sleep.

LivingBehaviorEvent.onAllowResettingTime

NeoForgeProperty
kotlin
@JvmField
@JvmField val onAllowResettingTime

Event triggered to check if time should reset after sleeping.

Returns

true to allow time reset, false to prevent it.

LivingBehaviorEvent.onModifySleepingDirection

NeoForgeProperty
kotlin
@JvmField
@JvmField val onModifySleepingDirection

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

Returns

The modified direction for the player to face.

LivingBehaviorEvent.onAllowSettingSpawn

NeoForgeProperty
kotlin
@JvmField
@JvmField 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

NeoForgeProperty
kotlin
@JvmField
@JvmField val onSetBedOccupationState

Event triggered to set the bed occupation state.

Returns

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

LivingBehaviorEvent.onModifyWakeUpPosition

NeoForgeProperty
kotlin
@JvmField
@JvmField val onModifyWakeUpPosition

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

Returns

The modified Vec3 wake-up position.

LivingBehaviorEvent.onPlayerWakeUp

NeoForgeProperty
kotlin
val onPlayerWakeUp

Event triggered when a player wakes up from sleeping.