Identifier of the block property.
Value of the block property.
Static
resolveIdentifier of the block to check.
Optional
states: Record<string, string | number | boolean>Given a type identifier and an optional set of properties, will return a BlockPermutation object that is usable in other block APIs (e.g., block.setPermutation)
import { DimensionLocation, BlockPermutation } from '@minecraft/server';
import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
const allWoolBlocks: string[] = [
MinecraftBlockTypes.WhiteWool,
MinecraftBlockTypes.OrangeWool,
MinecraftBlockTypes.MagentaWool,
MinecraftBlockTypes.LightBlueWool,
MinecraftBlockTypes.YellowWool,
MinecraftBlockTypes.LimeWool,
MinecraftBlockTypes.PinkWool,
MinecraftBlockTypes.GrayWool,
MinecraftBlockTypes.LightGrayWool,
MinecraftBlockTypes.CyanWool,
MinecraftBlockTypes.PurpleWool,
MinecraftBlockTypes.BlueWool,
MinecraftBlockTypes.BrownWool,
MinecraftBlockTypes.GreenWool,
MinecraftBlockTypes.RedWool,
MinecraftBlockTypes.BlackWool,
];
const cubeDim = 7;
function placeRainbowCube(location: DimensionLocation) {
let colorIndex = 0;
for (let x = 0; x <= cubeDim; x++) {
for (let y = 0; y <= cubeDim; y++) {
for (let z = 0; z <= cubeDim; z++) {
colorIndex++;
location.dimension
.getBlock({ x: location.x + x, y: location.y + y, z: location.z + z })
?.setPermutation(BlockPermutation.resolve(allWoolBlocks[colorIndex % allWoolBlocks.length]));
}
}
}
}
Contains the combination of type BlockType and properties (also sometimes called block state) which describe a block (but does not belong to a specific Block).
Example: createTranslatedSign.ts