A class that represents a block pattern.

Block patterns are used to generate blocks in a world.

Many things use them, such as many of the WorldEdit commands.

Constructors

  • Creates a new block pattern.

    Parameters

    • blocks: Omit<BlockPatternEntry, "raw" | "rawsb" | "rawns">[] = []

      The entries for the block pattern.

    • Optionaltype: "random" | "sequence" = "random"

      The type of the block pattern.

    Returns Globals.modules.cmds.BlockPattern

    A new block pattern.

Properties

blocks: BlockPatternEntry[] = []

The entries for the block pattern.

[]
type: "random" | "sequence" = "random"

The type of the block pattern.

"random" will make it generate the block pattern in a random order and will use the weights to determine the chance of each block pattern entry being selected.

"sequence" will make it generate the block pattern in a sequence and will use the weights to determine the number of times each block pattern entry will be repeated.

"random"

Accessors

  • get raw(): string

    The raw string representation of the block pattern.

    Returns string

    s:minecraft:example_block%36["facing"="west","fill_level"=5,"top_slot_bit"=true],minecraft:glass,minecraft:stone%10,minecraft:spruce_slab["top_slot_bit"=true]
    

    v1.33.1-preview.20+BUILD.1

Methods

  • Gets a block pattern entry.

    Parameters

    • OptionalgenerateIndex: number | bigint = 0

      The current index of the generation. This is used to determine which block pattern entry to get if the type is "sequence".

    • OptionalforceMode: "random" | "sequence"

      The type of the block pattern. If specified, it will override the type property of the block pattern.

    Returns BlockPatternEntry

    The block pattern entry.

  • Gets a block permutation from a block pattern entry.

    Parameters

    • OptionalgenerateIndex: number | bigint = 0

      The current index of the generation. This is used to determine which block pattern entry to get if the type is "sequence".

    • OptionalforceMode: "random" | "sequence"

      The type of the block pattern. If specified, it will override the type property of the block pattern.

    Returns BlockPermutation

    The block permutation.

  • Pushes a block pattern entry to the block pattern.

    Parameters

    • ...blocks: Omit<BlockPatternEntry, "raw" | "rawsb" | "rawns">[]

      The entries to push to the block pattern.

    Returns number

    The new amount of entries in the block pattern.

  • Converts the block pattern to a string.

    It returns the same value as BlockPattern.prototype.raw.

    Returns string

    The raw string representation of the block pattern.

    v1.33.1-preview.20+BUILD.1

  • Extracts a block pattern from a string.

    Parameters

    • str: string

      The string to extract the block pattern from.

    • Optionalmode: "random" | "sequence"

      The type of the block pattern. If not provided, the mode will be determined based on the string.

    Returns Globals.modules.cmds.BlockPattern

    The block pattern extracted from the string.

  • Extracts all block patterns from a string.

    Parameters

    • str: string

      The string to extract the block patterns from.

    • Optionalmode: "random" | "sequence"

      The type of the block patterns. If not provided, the mode will be determined based on the string.

    Returns Globals.modules.cmds.BlockPattern[]

    The block patterns extracted from the string.

  • Extracts all raw block patterns from a string.

    Parameters

    • str: string

      The string to extract the raw block patterns from.

    Returns string[]

    The raw block patterns, or null if no raw block patterns were found.

  • Extracts all raw block patterns from a string and returns the raw strings and the parsed block patterns.

    Parameters

    • str: string

      The string to extract the raw block patterns from.

    • Optionalmode: "random" | "sequence"

      The type of the block patterns. If not provided, the mode will be determined based on the string. Only applies to the block patterns, the raw strings are not affected.

    Returns { parsed: Globals.modules.cmds.BlockPattern[]; raw: string[] }

    The raw strings and the parsed block patterns. Only applies to the block patterns, the raw strings are not affected.

  • Extracts a raw block pattern from a string.

    Parameters

    • str: string

      The string to extract the raw block pattern from.

    Returns string

    The raw block pattern, or null if no raw block pattern was found.

  • Extracts a block pattern from a string and returns the raw string and the parsed block pattern.

    Parameters

    • str: string

      The string to extract the block pattern from.

    • Optionalmode: "random" | "sequence"

      The type of the block pattern. If not provided, the mode will be determined based on the string. Only Only applies to the block pattern, the raw string is not affected.

    Returns { parsed: Globals.modules.cmds.BlockPattern; raw: string }

    The raw string and the parsed block pattern. Only applies to the block pattern, the raw string is not affected.

  • Parses a string into a BlockPattern object.

    Returns void

    This function is non-functional, and does absolutely nothing.