LivingEntityUseBlockEvent
LivingEntityUseBlockEvent
Section titled “LivingEntityUseBlockEvent”DEPRECATED — This event is deprecated. Use
UseBlockEvent(ECS event) instead.
Package:
com.hypixel.hytale.server.core.event.events.entityImplements:IEvent<String>Cancellable: No Key type:String
Dispatched after a living entity uses (interacts with) a block. This event has been replaced by the ECS-based UseBlockEvent which provides richer context and cancellation support.
Because the key type is String, this event is dispatched with a keyed dispatch using the block type as the key.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Notes |
|---|---|---|---|---|
ref | Ref<EntityStore> | getRef() | No | ECS reference to the entity that used the block. |
blockType | String | getBlockType() | No | The type identifier of the block that was used. |
Fired By
Section titled “Fired By”UseBlockInteraction(line 81) viaeventBus.dispatchFor()— dispatched after a block use interaction completes. This is a post-use notification and cannot prevent the interaction.
Listening
Section titled “Listening”getEventRegistry().register(LivingEntityUseBlockEvent.class, event -> { Ref<EntityStore> entityRef = event.getRef(); String blockType = event.getBlockType();
// Handle block use (deprecated -- prefer UseBlockEvent)});Migration
Section titled “Migration”This event should be replaced with the ECS-based UseBlockEvent:
// Old (deprecated):getEventRegistry().register(LivingEntityUseBlockEvent.class, event -> { ... });
// New (preferred):// Register an EntityEventSystem<EntityStore, UseBlockEvent> instead.// See UseBlockEvent documentation for the ECS event handler pattern.Related Events
Section titled “Related Events”UseBlockEvent— the ECS-based replacement for this event. Provides cancellation support and richer context.BreakBlockEvent— ECS event for block destruction (distinct from block use).PlaceBlockEvent— ECS event for block placement.