Represents a block in a dimension. A block represents a unique X, Y, and Z within a dimension and get/sets the state of the block at that location. This type was significantly updated in version 1.17.10.21.

Hierarchy

  • Block

Constructors

  • Returns Block

Properties

dimension: Dimension

Remarks

Returns the dimension that the block is within.

isAir: boolean

Remarks

Returns true if this block is an air block (i.e., empty space).

Throws

This property can throw when used.

LocationInUnloadedChunkError

LocationOutOfWorldBoundariesError

isLiquid: boolean

Remarks

Returns true if this block is a liquid block - (e.g., a water block and a lava block are liquid, while an air block and a stone block are not. Water logged blocks are not liquid blocks).

Throws

This property can throw when used.

LocationInUnloadedChunkError

LocationOutOfWorldBoundariesError

location: Vector3

Remarks

Coordinates of the specified block.

Throws

This property can throw when used.

permutation: BlockPermutation

Remarks

Additional block configuration data that describes the block.

Throws

This property can throw when used.

LocationInUnloadedChunkError

LocationOutOfWorldBoundariesError

x: number

Remarks

X coordinate of the block.

y: number

Remarks

Y coordinate of the block.

z: number

Remarks

Z coordinate of the block.

Methods

  • Parameters

    • componentId: string

      The identifier of the component (e.g., 'minecraft:inventory'). If no namespace prefix is specified, 'minecraft:' is assumed. Available component IDs can be found as part of the BlockComponentTypes enum.

    Returns undefined | BlockComponent

    Returns the component if it exists on the block, otherwise undefined.

    Remarks

    Gets a component (that represents additional capabilities) for a block - for example, an inventory component of a chest block.

    Throws

    This function can throw errors.

    LocationInUnloadedChunkError

    LocationOutOfWorldBoundariesError

  • Returns boolean

    True if this block object is still working and valid.

    Remarks

    Returns true if this reference to a block is still valid (for example, if the block is unloaded, references to that block will no longer be valid.)

  • Parameters

    • permutation: BlockPermutation

      Permutation that contains a set of property states for the Block.

    Returns void

    Remarks

    Sets the block in the dimension to the state of the permutation.

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

    Throws

    This function can throw errors.

    LocationInUnloadedChunkError

    LocationOutOfWorldBoundariesError