Script API - v1.20.60
    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).

    Index

    Methods

    • Parameters

      • stateName: string

        Name of the block state who's value is to be returned.

      Returns string | number | boolean

      Returns the state if the permutation has it, else undefined.

      Gets a state for the permutation.

    • Parameters

      • blockName: string

        An optional set of states to compare against.

      • Optionalstates: 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.

    • 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 throw errors.

    • Parameters

      • blockName: string

        Identifier of the block to check.

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

      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 throw errors.

      const allColorNames: string[] = [
      "white",
      "orange",
      "magenta",
      "light_blue",
      "yellow",
      "lime",
      "pink",
      "gray",
      "silver",
      "cyan",
      "purple",
      "blue",
      "brown",
      "green",
      "red",
      "black",
      ];

      const cubeDim = 7;

      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++;
      overworld
      .getBlock({ x: targetLocation.x + x, y: targetLocation.y + y, z: targetLocation.z + z })
      ?.setPermutation(
      mc.BlockPermutation.resolve("minecraft:wool", {
      color: allColorNames[colorIndex % allColorNames.length],
      })
      );
      }
      }
      }