Interface in @minecraft/server
Extends PlayerDropItemAfterEvent, CancellableEvent
Basalt’s own: cancelled, the item goes back into the inventory.
import type { PlayerDropItemBeforeEvent } from '@minecraft/server';Subscribe to it with world.beforeEvents.playerDropItem.
Example
Section titled “Example”import { world, type PlayerDropItemBeforeEvent } from '@minecraft/server';
world.beforeEvents.playerDropItem.subscribe((event: PlayerDropItemBeforeEvent) => { console.log('playerDropItem', event.player.name, event.itemStack.typeId);
// Uncomment to stop it from happening. // event.cancel = true;});import { world } from '@minecraft/server';
world.beforeEvents.playerDropItem.subscribe((event) => { console.log('playerDropItem', event.player.name, event.itemStack.typeId);
// Uncomment to stop it from happening. // event.cancel = true;});Used by
Section titled “Used by”WorldBeforeEvents.playerDropItem
Inherited
Section titled “Inherited”From PlayerDropItemAfterEvent: player, itemStack
From CancellableEvent: cancel