Interface in @minecraft/server
An arrow, trident or thrown thing hit a block.
import type { ProjectileHitBlockAfterEvent } from '@minecraft/server';Subscribe to it with world.afterEvents.projectileHitBlock.
Example
Section titled “Example”import { world, type ProjectileHitBlockAfterEvent } from '@minecraft/server';
world.afterEvents.projectileHitBlock.subscribe((event: ProjectileHitBlockAfterEvent) => { console.log('projectileHitBlock', event.dimension.id, event.projectile.typeId, event.source?.typeId);});import { world } from '@minecraft/server';
world.afterEvents.projectileHitBlock.subscribe((event) => { console.log('projectileHitBlock', 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;Which way it was flying, as a unit vector.
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;Who shot or threw it.
Types
Methods
Section titled “Methods”getBlockHit
Section titled “getBlockHit”getBlockHit(): BlockHitInformation;Returns
BlockHitInformationTypes
Used by
Section titled “Used by”WorldAfterEvents.projectileHitBlock, ProjectileHitBlockAfterEventSignal.subscribe, ProjectileHitBlockAfterEventSignal.unsubscribe