BetaReadonly BetadimensionReadonly BetaisReadonly BetaisReadonly BetaisReadonly BetaisReadonly BetaisReadonly BetalocalizationReadonly BetalocationReadonly BetapermutationReadonly BetatypeReadonly BetatypeReadonly BetaxReadonly BetayReadonly BetazBetaOptionalsteps: numberNumber of steps above to step before returning. Defaults to: 1
BetaOptionalsteps: numberNumber of steps below to step before returning. Defaults to: 1
BetaThe type of liquid this function should be called for.
Whether this block is removed when touched by liquid.
BetaThe type of liquid this function should be called for.
Whether this block can have a liquid placed over it.
BetaBlock type or block permutation to check placement for.
OptionalfaceToPlaceOn: DirectionOptional specific face of this block to check placement against.
Returns true if the block type or permutation can be
placed on this block, else false.
BetaOptionalsteps: numberNumber of steps to the east to step before returning. Defaults to: 1
BetaThe identifier of the component (e.g., 'minecraft:inventory'). If no namespace prefix is specified, 'minecraft:' is assumed. Available component IDs are those in the BlockComponentTypes enum and custom component IDs registered with the BlockComponentRegistry.
Returns the component if it exists on the block, otherwise undefined.
BetaOptionalamount: numberNumber of instances of this block to place in the item stack. Defaults to: 1
OptionalwithData: booleanWhether additional data facets of the item stack are included. Defaults to: false
An itemStack with the specified amount of items and data. Returns undefined if block type is incompatible.
BetaTag to check for.
Returns true if the permutation of this block has the tag,
else false.
import { DimensionLocation } from "@minecraft/server";
function checkBlockTags(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
// Fetch the block
const block = targetLocation.dimension.getBlock(targetLocation);
// check that the block is loaded
if (block) {
log(`Block is dirt: ${block.hasTag("dirt")}`);
log(`Block is wood: ${block.hasTag("wood")}`);
log(`Block is stone: ${block.hasTag("stone")}`);
}
}
BetaThe type of liquid this function should be called for.
Whether this block stops liquid from flowing.
BetaWhether liquid can flow into the block from the provided direction, or flow out from the provided direction when liquid is placed into it with a bucket
BetaThe type of liquid this function should be called for.
Whether this block is removed and spawns its item when touched by liquid.
BetaBlock type identifier to match this API against.
Optionalstates: Record<string, string | number | boolean>Optional set of block states to test this block against.
Returns true if the block matches the specified criteria.
BetaOptionalsteps: numberNumber of steps to the north to step before returning. Defaults to: 1
BetaThe offset vector. For example, an offset of 0, 1, 0 will return the block above the current block.
Block at the specified offset, or undefined if that block could not be retrieved (for example, the block and its relative chunk is not loaded yet.)
BetaPermutation that contains a set of property states for the Block.
BetaIdentifier of the type of block to apply - for example, minecraft:powered_repeater.
Betatrue if the block should have water within it.
BetaOptionalsteps: numberNumber of steps to the south to step before returning. Defaults to: 1
BetaPermutation that contains a set of property states for the Block.
Returns true if the block permutation data was
successfully set, else false.
BetaOptionalsteps: numberNumber of steps to the west to step before returning. Defaults to: 1
Represents a block in a dimension. A block represents a unique X, Y, and Z within a dimension and get/sets the state of the block at that location. This type was significantly updated in version 1.17.10.21.