Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts
    Before events

    ItemUseBeforeEvent

    1 min read · 3 sections
    On this page

    Interface in @minecraft/server

    Extends ItemUseAfterEvent, CancellableEvent

    The held item used in the air, before it’s eaten, drawn or thrown.

    import type { ItemUseBeforeEvent } from '@minecraft/server';

    Subscribe to it with world.beforeEvents.itemUse.

    import { world, type ItemUseBeforeEvent } from '@minecraft/server';
    world.beforeEvents.itemUse.subscribe((event: ItemUseBeforeEvent) => {
    console.log('itemUse', event.source.name, event.itemStack.typeId);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });
    import { world } from '@minecraft/server';
    world.beforeEvents.itemUse.subscribe((event) => {
    console.log('itemUse', event.source.name, event.itemStack.typeId);
    // Uncomment to stop it from happening.
    // event.cancel = true;
    });

    WorldBeforeEvents.itemUse, ItemUseBeforeEventSignal.subscribe, ItemUseBeforeEventSignal.unsubscribe

    From ItemUseAfterEvent: source, itemStack

    From CancellableEvent: cancel