Interface in @minecraft/server
Extends CancellableEvent
An explosion about to break blocks.
import type { ExplosionBeforeEvent } from '@minecraft/server';Subscribe to it with world.beforeEvents.explosion.
Example
Section titled “Example”import { world, type ExplosionBeforeEvent } from '@minecraft/server';
world.beforeEvents.explosion.subscribe((event: ExplosionBeforeEvent) => { console.log('explosion', event.dimension.id, event.source?.typeId);
// Uncomment to stop it from happening. // event.cancel = true;});import { world } from '@minecraft/server';
world.beforeEvents.explosion.subscribe((event) => { console.log('explosion', event.dimension.id, event.source?.typeId);
// Uncomment to stop it from happening. // event.cancel = true;});Properties
Section titled “Properties”dimension
Section titled “dimension”read-only
readonly dimension: Dimension;Types
source
Section titled “source”read-only
readonly source: Entity | undefined;The creeper or other thing that went off.
Types
Methods
Section titled “Methods”getImpactedBlocks
Section titled “getImpactedBlocks”getImpactedBlocks(): Block[];What it will break; none when mobs may not grief.
Returns
Block[]Types
setImpactedBlocks
Section titled “setImpactedBlocks”setImpactedBlocks(blocks: Block[]): void;Breaks these instead.
Parameters
blocksBlock[]
Types
Used by
Section titled “Used by”WorldBeforeEvents.explosion, ExplosionBeforeEventSignal.subscribe, ExplosionBeforeEventSignal.unsubscribe
Inherited
Section titled “Inherited”From CancellableEvent: cancel