content
Declares an experience's blocks, items, mobs, models, images, HUD layouts, tags, recipes and structures. It exists only in content.luau, which runs once when the experience's content is built, before any game script starts; game scripts cannot declare content. The file sees content, the standard library and require of modules inside the experience, nothing of the world or players.
Every id is a key this call declares: bare ("ruby") becomes <experience>:ruby, and an explicit namespace must be the experience's own. References to other content may also name minecraft: keys; another experience's keys are unreachable. Key paths are 1 to 128 of lowercase a-z, 0-9, _, -, . and /. "#name" names a tag. Each kind of thing (block, item, tag, model, image, HUD layout, mob, recipe) has its own keys; a block with item also takes the item key.
Models and textures come from the experience's assets/ folder: PNGs under textures/ and JSON under models/ and items/, at any depth, nothing else. A model key x of this experience needs assets/models/x.json or assets/textures/x.png. Each file is at most 1 MiB, the folder at most 16 MiB and 4096 files, and a PNG at most 1024 pixels a side.
Mistakes are refused when content is built and reported as file:line of the call that caused them, even inside pcall: a malformed table or unknown field, a duplicate key, a key outside the experience, a missing asset, an unknown reference, or a quota passed. Quotas: 2048 declarations, 256 donor states, 512 models, 2,000,000 structure cells, and a 5 second, 32 MiB run of the script.
Functions
Declares a custom block.
-- In content.luau. A vanilla block under this experience's own id: its states, shape, hardness,
-- item and drops come from the vanilla block, and the other fields override them.
content.block("red_wool", { vanilla = "minecraft:red_wool", tool = "#cutters" })
-- A bed with no item of its own, so breaking it drops nothing either.
content.block("red_bed", { vanilla = "minecraft:red_bed", item = false })
-- A custom block drawn from a donor pool. It has an item that places it and that it drops;
-- `name` is the English name its item shows.
content.block("crate", {
visual = { pool = "note_block" },
name = "Supply Crate",
hardness = 1.5,
item = { model = "block/crate", stack = 16 },
})
-- A decoration nobody keeps: it still has an item for building, but breaks into nothing.
content.block("cobweb_trap", { visual = "minecraft:cobweb", drops = false })Declares a block tag. Members are block keys, declared here or minecraft:; "#name" includes another block tag declared here. A tag may not include itself.
Declares a HUD layout; each region reserves rows of the HUD images and fonts it draws.
Declares a custom item.
-- In content.luau. A custom item built on a vanilla one; bare ids are this experience's own.
content.item("coin", { base = "minecraft:sunflower", name = "Coin", color = 0xFFD700, stack = 64 })
-- Lore lines show under the name; `stack` caps how many fit in one slot.
content.item("dash_feather", {
base = "minecraft:feather",
name = "Dash Feather",
color = 0x55FFFF,
lore = { "Right-click to dash forward." },
stack = 16,
})Declares an item tag. Members are item keys, declared here or minecraft:; "#name" includes another item tag declared here. A tag may not include itself.
Declares a display model scripts can show, from assets/models/<path>.json or assets/textures/<path>.png.
A block-state property that takes one of the given distinct string values.
A whole-number block-state property from min to max, inclusive.
Declares a crafting recipe of ingredients in any arrangement.