类 StructureManager实验性

Manager for Structure related APIs. Includes APIs for creating, getting, placing and deleting Structures.

方法

  • 实验性

    参数

    • identifier: string

      The name of the structure. A valid identifier must include a namespace and must be unique.

    • dimension: Dimension

      The dimension where the blocks should be read from.

    • from: Vector3
    • to: Vector3
    • 可选options: StructureCreateOptions

      Additional options for creating a structure from the world.

    返回 Structure

    Returns the newly created Structure.

    Creates a new Structure from blocks in the world. This is functionally equivalent to the /structure save command.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    Throws if the identifier is invalid. A valid identifier must include a namespace and must be unique. Throws if the structure bounds exceed the maximum size. Throws if the structure bounds contains blocks outside the world bounds.

    minecraftcommon.InvalidArgumentError

  • 实验性

    参数

    • structure: string | Structure

      The structure identifier or Structure object that should be deleted. Note, a Structure object will become invalid after it is deleted.

    返回 boolean

    Returns whether the structure was removed.

    Deletes a structure from memory and from the world if it exists.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    Throws if a structure cannot be removed. For example, a structure loaded from a Behavior Pack.

    minecraftcommon.InvalidArgumentError

  • 实验性

    参数

    • identifier: string

      The name of the structure to get.

    返回 Structure

    Returns a Structure if it exists, otherwise undefined.

    Gets a Structure that is saved to memory or the world.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

  • 实验性

    参数

    • pool: string

      The identifier of the template pool to start from.

    • targetJigsaw: string

      The name of the jigsaw block to start from. This block must be included in at least one of the starting pool structure templates.

    • maxDepth: number

      The maximum recursion depth for the jigsaw structure.

    • dimension: Dimension

      The dimension to place the jigsaw structure in.

    • location: Vector3

      The location where the jigsaw structure will begin generating relative to the targetJigsaw block.

    • 可选options: JigsawPlaceOptions

      Optional settings to use when generating the jigsaw structure.

    返回 void

    Places a partial jigsaw structure in the world. This is useful for debugging connections between jigsaw blocks.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    Throws if maxDepth is outside of the range [1,20] Throws if generation fails due to invalid parameters or jigsaw configuration. Throws if the placement location contains blocks that are outside the world bounds.

    PlaceJigsawError

  • 实验性

    参数

    • identifier: string

      The identifier of the jigsaw structure.

    • dimension: Dimension

      The dimension to place the jigsaw structure in.

    • location: Vector3

      The location where the jigsaw structure will begin generating. Note that the y value will be overridden by the structure's start height unless the ignoreStarJigsawStructurePlaceOptions ignoreStartHeight option is set.

    • 可选options: JigsawStructurePlaceOptions

      Optional settings to use when generating the jigsaw structure.

    返回 void

    Places a jigsaw structure in the world.

    无法在只读模式下调用此函数,详见 WorldBeforeEvents

    Throws if generation fails due to invalid parameters or jigsaw configuration. Throws if the placement location contains blocks that are outside the world bounds.

    PlaceJigsawError