Experimental

An early preview: docs, the API and the dashboard may change or break.

Report a problem
Module

@ember/blocks

Signals for the experience's custom block types and block tags.

local blocks = require("@ember/blocks")

Fields

blocks.air: blocks.BlockType<{}, nil>
#
read only

Present in every world, with or without packs.

Functions

blocks.tag(name: string) -> blocks.BlockType<{ [string]: types.StateValue }, any>
#

The block tag with the name, loosely typed; raises for an unknown tag.

local blocks = require("@ember/blocks")
local items = require("@ember/items")

-- A block tag's signals fire for every block in it; "#ores" is a tag declared in content.luau.
local ores = blocks.tag("#ores")

ores.broken:connect(function(event)
	event.player.inventory:add(items.create("minecraft:emerald", { name = "<green>Ore Bonus" }))
end)
blocks.type(id: string) -> blocks.BlockType<{ [string]: types.StateValue }, any>
#

The block type with the id, loosely typed; typed handles come from @content and @pack/<name>. Raises for an unknown id.

local blocks = require("@ember/blocks")

-- Signals for a custom block declared in content.luau as "checkpoint".
local checkpoint = blocks.type("checkpoint")

-- Right-clicking a checkpoint saves it as the player's respawn point, one block above it.
checkpoint.used:connect(function(event)
	event.player:setRespawn(event.position + vector.create(0.5, 1, 0.5))
	event.player:send("<green>Checkpoint saved!")
end)

Types