Script API - v1.19.80
    Preparing search index...

    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). This type was introduced as of version 1.17.10.21.

    Index

    Constructors

    Properties

    type: BlockType

    The BlockType that the permutation has.

    Methods

    • Beta

      Returns Record<string, string | number | boolean>

      This function can't be called in read-only mode.

    • Beta

      Parameters

      • Optionalamount: number

        Number of instances of this block to place in the prototype item stack.

      Returns ItemStack

      Retrieves a prototype item stack based on this block permutation that can be used with item Container/ContainerSlot APIs.

      This function can't be called in read-only mode.

    • Beta

      Parameters

      • propertyName: string

      Returns undefined | string | number | boolean

      This function can't be called in read-only mode.

    • Beta

      Returns string[]

      Creates a copy of the permutation.

      This function can't be called in read-only mode.

    • Beta

      Parameters

      • tag: string

      Returns boolean

      Returns true if the permutation has the tag, else false.

      Checks to see if the permutation has a specific tag.

      This function can't be called in read-only mode.

      import { world } from "@minecraft/server";

      // Fetch the block
      const block = world.getDimension("overworld").getBlock({ x: 1, y: 2, z: 3 });
      const blockPerm = block.getPermutation();

      console.log(`Block is dirt: ${blockPerm.hasTag("dirt")}`);
      console.log(`Block is wood: ${blockPerm.hasTag("wood")}`);
      console.log(`Block is stone: ${blockPerm.hasTag("stone")}`);
    • Parameters

      • blockName: string

        An optional set of states to compare against.

      • Optionalproperties: Record<string, string | number | boolean>

      Returns boolean

      Returns a boolean whether a specified permutation matches this permutation. If states is not specified, matches checks against the set of types more broadly.

      This function can't be called in read-only mode.

    • Beta

      Parameters

      • name: string

        Identifier of the block property.

      • value: string | number | boolean

        Value of the block property.

      Returns BlockPermutation

      Returns a derived BlockPermutation with a specific property set.

      This function can't be called in read-only mode.

      This function can throw errors.

    • Parameters

      • blockName: string

        Identifier of the block to check.

      • Optionalproperties: Record<string, string | number | boolean>

        Optional additional set of properties to check against.

      Returns BlockPermutation

      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)

      This function can't be called in read-only mode.

      This function can throw errors.