Skip to content

Block

Represents a block in the game, describing its type, light emission, and other characteristics.

Fields

type: BlockType Read-Only

A reference to the specific type of the block (e.g., stone, dirt).

luminance: number Read-Only

The light level emitted by the block.

burnable: boolean Read-Only

Indicates whether the block is flammable.

opaque: boolean Read-Only

Indicates whether the block is opaque and blocks light.

toolRequired: boolean Read-Only

Indicates whether a specific tool is required to break the block effectively.

data: table Read-Only

table A reference to the modifiable collection of additional block-specific attributes. For example, a "ladder" has a "facing" attribute, and "grass" has a "snowy" attribute.

Methods

new(id: string) block: Block

Initializes a new block with the specified type.

Example

local b = Block:new("stone")
print(b.type)  -- Outputs "stone"

Parameters

Name Type Description
id string The identifier for the block type (e.g., "stone", "wood").

Returns

  • Block — block A new instance of a Block with the specified type.