Skip to content

LivingEntityUseBlockEvent

DEPRECATED — This event is deprecated. Use UseBlockEvent (ECS event) instead.

Package: com.hypixel.hytale.server.core.event.events.entity Implements: 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.

FieldTypeAccessorMutableNotes
refRef<EntityStore>getRef()NoECS reference to the entity that used the block.
blockTypeStringgetBlockType()NoThe type identifier of the block that was used.
  • UseBlockInteraction (line 81) via eventBus.dispatchFor() — dispatched after a block use interaction completes. This is a post-use notification and cannot prevent the interaction.
getEventRegistry().register(LivingEntityUseBlockEvent.class, event -> {
Ref<EntityStore> entityRef = event.getRef();
String blockType = event.getBlockType();
// Handle block use (deprecated -- prefer UseBlockEvent)
});

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.
  • 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.