Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Additional configuration options for the @minecraft/server.Dimension.createExplosion method.
Properties
allowUnderwater
allowUnderwater?: boolean;
Whether parts of the explosion also impact underwater.
Type: boolean
breaksBlocks
breaksBlocks?: boolean;
Whether the explosion will break blocks within the blast radius.
Type: boolean
causesFire
causesFire?: boolean;
If true, the explosion is accompanied by fires within or near the blast radius.
Type: boolean
source
source?: Entity;
Optional source of the explosion.
Type: Entity
Examples
createNoBlockExplosion.ts
import { DimensionLocation } from "@minecraft/server";
import { Vector3Utils } from "@minecraft/math";
function createNoBlockExplosion(
log: (message: string, status?: number) => void,
targetLocation: DimensionLocation
) {
const explodeNoBlocksLoc = Vector3Utils.floor(Vector3Utils.add(targetLocation, { x: 1, y: 2, z: 1 }));
log("Creating an explosion of radius 15 that does not break blocks.");
targetLocation.dimension.createExplosion(explodeNoBlocksLoc, 15, { breaksBlocks: false });
}
(preview) Work with this sample on the MCTools.dev code sandbox.
createExplosions.ts
import { DimensionLocation } from "@minecraft/server";
import { Vector3Utils } from "@minecraft/math";
function createExplosions(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
const explosionLoc = Vector3Utils.add(targetLocation, { x: 0.5, y: 0.5, z: 0.5 });
log("Creating an explosion of radius 15 that causes fire.");
targetLocation.dimension.createExplosion(explosionLoc, 15, { causesFire: true });
const belowWaterLoc = Vector3Utils.add(targetLocation, { x: 3, y: 1, z: 3 });
log("Creating an explosion of radius 10 that can go underwater.");
targetLocation.dimension.createExplosion(belowWaterLoc, 10, { allowUnderwater: true });
}
(preview) Work with this sample on the MCTools.dev code sandbox.