Blocks

The blocks that make the world of Minecraft can be manipulated with code: place, fill, clone, replace are all possible with the blocks below.

Learn about positions as most blocks commands use them.

Types

A block type is represented by a number, composed of its ID value and optional data values. Various helpers like ||blocks:block|| or ||blocks:blockWithData|| are there to help you craft the block you want.

Reference

blocks.place(GRASS, pos(0, 0, 0));
blocks.fill(
    GRASS,
    pos(0, 0, 0),
    pos(0, 0, 0),
    FillOperation.Replace
);
blocks.onBlockPlaced(GRASS, () => {

});
blocks.onBlockBroken(GRASS, () => {

});
blocks.testForBlock(GRASS, pos(0, 0, 0));
GRASS;
IRON_SHOVEL;

Volumes

blocks.print(
    "HELLO",
    GRASS,
    pos(0, 0, 0),
    WEST
);
blocks.replace(
    GRASS,
    GRASS,
    pos(0, 0, 0),
    pos(0, 0, 0)
);
blocks.clone(
    pos(0, 0, 0),
    pos(0, 0, 0),
    pos(0, 0, 0),
    CloneMask.Replace,
    CloneMode.Normal
);
blocks.cloneFiltered(
    pos(0, 0, 0),
    pos(0, 0, 0),
    pos(0, 0, 0),
    GRASS,
    CloneMode.Normal
);

Advanced

blocks.blockWithData(GRASS, 0);
blocks.blockById(0);
blocks.blockByName("stone");
blocks.repeater(WEST, 1);
blocks.comparator(WEST, ComparatorMode.Compare);
blocks.lever(BLOCK_BOTTOM_EAST_WHEN_OFF);