Class Block

Represent a world's block

Hierarchy

Constructors

Properties

attributes: attrsType = ...

Represent attributes

Example

# This is how block's attributes are working:
minecraft:dirt[name=value, name2=value, ...]
attributesData: { name: string; value: any }[]
coords: string[]
name: string
nbt?: { get: ((path?: NBTPath, scale?: number) => string); reset: (() => string); set: ((value: string | number | NBTData, path?: NBTPath) => string); store: ((path: NBTPath, type: "success" | "result", from: string) => string) } = ...

Type declaration

  • get: ((path?: NBTPath, scale?: number) => string)
      • (path?: NBTPath, scale?: number): string
      • Get a nbt for this block

        Parameters

        • Optional path: NBTPath

          The path to the block's NBT

        • Optional scale: number

          The scale to multiply the request NBT after get it

        Returns string

  • reset: (() => string)
      • (): string
      • Reset all the NBT for this block

        Returns string

  • set: ((value: string | number | NBTData, path?: NBTPath) => string)
      • (value: string | number | NBTData, path?: NBTPath): string
      • Set a nbt for this block

        Parameters

        • value: string | number | NBTData

          The value to set to this NBT

        • Optional path: NBTPath

          The path to the block's NBT

        Returns string

  • store: ((path: NBTPath, type: "success" | "result", from: string) => string)
      • (path: NBTPath, type: "success" | "result", from: string): string
      • Store data from a command

        Parameters

        • path: NBTPath

          The path to the block's NBT

        • type: "success" | "result"

          The type of result you want:
          success: If the command has been correcly executed, it will returns 1, else 0
          result: Will returns the callback of the executed command

        • from: string

          The command the NBT will execute to store itself

        Returns string

zone: boolean

Methods

  • Place to the given coordonates the block

    Parameters

    • position: coordonate

      The position where to place the block

    • Optional to: { x: number; y: number; z: number }

      If this is a Zone, the opposite corner of the zone to place the block

      • x: number
      • y: number
      • z: number

    Returns string

  • Set to the block's coordonate/zone the given block

    Exemple

    const b = new Block({...})
    b.set("minecraft:dirt")

    Parameters

    • Optional block: string

      The name of the block to place

    Returns string

Generated using TypeDoc