PlaceBlockEvent
PlaceBlockEvent
Section titled “PlaceBlockEvent”Package:
com.hypixel.hytale.server.core.event.events.ecsExtends:CancellableEcsEventImplements:ICancellableEcsEventCancellable: Yes
ECS event dispatched when a player places a block in the world. Cancelling this event prevents the block from being placed.
Fields / Accessors
Section titled “Fields / Accessors”| Field | Type | Accessor | Mutable | Nullable |
|---|---|---|---|---|
itemInHand | ItemStack | getItemInHand() | No | Yes |
targetBlock | Vector3i | getTargetBlock() | Yes | No |
rotation | RotationTuple | getRotation() | Yes | No |
- itemInHand — The item the player is holding when placing the block. May be
nullif the placement is triggered programmatically without an item context. - targetBlock — The world-space coordinates where the block will be placed. Mutable — changing this redirects the placement location.
- rotation — The rotation applied to the placed block. Mutable — changing this alters the block’s orientation.
Fired By
Section titled “Fired By”BlockPlaceUtils(line 102) viaentityStore.invoke(ref, event)— ECS dispatch when a player places a block into the world.
Listening
Section titled “Listening”ECS events are handled by EntityEventSystem subclasses, not by getEventRegistry().register().
public class MyPlaceBlockHandler extends EntityEventSystem<EntityStore, PlaceBlockEvent> { @Override public Query<EntityStore> getQuery() { return MY_COMPONENT_TYPE; }
@Override public void handle(int index, ArchetypeChunk<EntityStore> chunk, Store<EntityStore> store, CommandBuffer<EntityStore> commandBuffer, PlaceBlockEvent event) { Vector3i target = event.getTargetBlock(); ItemStack item = event.getItemInHand();
// Example: prevent placing blocks above Y=200 if (target.y() > 200) { event.setCancelled(true); } }}
// Register in plugin setup():getEntityStoreRegistry().registerSystem(new MyPlaceBlockHandler());Related Events
Section titled “Related Events”BreakBlockEvent— The inverse operation: fired when a player finishes mining a block.DamageBlockEvent— Fired for each mining progress tick. Part of the block-mining lifecycle.UseBlockEvent— Fired when a player interacts with (uses) a block rather than placing one.