Interface in @minecraft/server
Basalt’s own: an item came into the world, dropped, thrown or spilled from a block.
import type { ItemSpawnAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.itemSpawn.
Example
Section titled “Example”import { world, type ItemSpawnAfterEvent } from '@minecraft/server';
world.afterEvents.itemSpawn.subscribe((event: ItemSpawnAfterEvent) => { console.log('itemSpawn', event.entity.typeId, event.itemStack?.typeId);});import { world } from '@minecraft/server';
world.afterEvents.itemSpawn.subscribe((event) => { console.log('itemSpawn', event.entity.typeId, event.itemStack?.typeId);});Properties
Section titled “Properties”entity
Section titled “entity”read-only
readonly entity: ItemEntity;Types
itemStack
Section titled “itemStack”read-only
readonly itemStack: ItemStack | undefined;Types
location
Section titled “location”read-only
readonly location: Vector3;Types