The PlayerInteractWithEntityAfterEvent interface in @minecraft/server.
Interface in @minecraft/server
Extended by PlayerInteractWithEntityBeforeEvent
import type { PlayerInteractWithEntityAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.playerInteractWithEntity.
Example
Section titled “Example”import { world, type PlayerInteractWithEntityAfterEvent } from '@minecraft/server';
world.afterEvents.playerInteractWithEntity.subscribe((event: PlayerInteractWithEntityAfterEvent) => { console.log('playerInteractWithEntity', event.player.name, event.target.typeId, event.itemStack?.typeId);});import { world } from '@minecraft/server';
world.afterEvents.playerInteractWithEntity.subscribe((event) => { console.log('playerInteractWithEntity', event.player.name, event.target.typeId, event.itemStack?.typeId);});Properties
Section titled “Properties”player
Section titled “player”read-only
readonly player: Player;Types
target
Section titled “target”read-only
readonly target: Entity;Types
itemStack
Section titled “itemStack”read-only
readonly itemStack: ItemStack | undefined;Types
Used by
Section titled “Used by”WorldAfterEvents.playerInteractWithEntity, PlayerInteractWithEntityAfterEventSignal.subscribe, PlayerInteractWithEntityAfterEventSignal.unsubscribe