Interface in @minecraft/server
An arrow, trident or thrown thing hit a player or mob.
import type { ProjectileHitEntityAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.projectileHitEntity.
Example
Section titled “Example”import { world, type ProjectileHitEntityAfterEvent } from '@minecraft/server';
world.afterEvents.projectileHitEntity.subscribe((event: ProjectileHitEntityAfterEvent) => { console.log('projectileHitEntity', event.dimension.id, event.projectile.typeId, event.source?.typeId);});import { world } from '@minecraft/server';
world.afterEvents.projectileHitEntity.subscribe((event) => { console.log('projectileHitEntity', event.dimension.id, event.projectile.typeId, event.source?.typeId);});Properties
Section titled “Properties”dimension
Section titled “dimension”read-only
readonly dimension: Dimension;Types
hitVector
Section titled “hitVector”read-only
readonly hitVector: Vector3;Types
location
Section titled “location”read-only
readonly location: Vector3;Types
projectile
Section titled “projectile”read-only
readonly projectile: Entity;Types
source
Section titled “source”read-only
readonly source: Entity | undefined;Types
Methods
Section titled “Methods”getEntityHit
Section titled “getEntityHit”getEntityHit(): EntityHitInformation;Returns
EntityHitInformationTypes
Used by
Section titled “Used by”WorldAfterEvents.projectileHitEntity, ProjectileHitEntityAfterEventSignal.subscribe, ProjectileHitEntityAfterEventSignal.unsubscribe