2.7 KiB
Tools
A tool is an item with a tool property. It breaks blocks of its type faster, lets players get drops from blocks that
require it, and wears out over time.
{
"format_version": 1,
"item": {
"id": "copper_tools:copper_pickaxe",
"texture": "copper_tools:copper_pickaxe",
"tool": { "type": "pickaxe", "tier": 1, "speed": 4, "durability": 5 }
}
}
| Field | Default | Meaning |
|---|---|---|
type |
required | Matched against blocks' mining.tool, like "pickaxe", "axe", "shovel", "hoe" or "knife". Any word works. |
durability |
required | How many uses it has before it breaks, see below. |
tier |
0 |
Compared with blocks' mining.tier. |
speed |
2 |
How many times faster than a hand it breaks blocks of its type. |
Tools stack to 1 unless they set max_stack.
Mining
A block breaks speed times faster when the held tool's type is the block's mining.tool. A block with
"requires_tool": true only drops when broken with a tool of its type whose tier is at least the block's
mining.tier. See Mining.
The base game's tiers:
| Tier | Tools | Durability | Gets drops from |
|---|---|---|---|
0 |
wood, gold | 2 (wood), 9 (gold) | stone, coal ore |
1 |
stone, copper | 3 (stone), 5 (copper) | also copper, tin, iron and gold ore |
2 |
iron | 7 | everything so far |
Tool types don't have to be the base game's. A mod can add a "sickle" type and blocks with "tool": "sickle", and a
server script can check a held item's type with ctx.items.tool(id), like the base game's bworld:hoeable does for
hoes.
Durability
Like Sunlit Valley, tools don't wear out from use. They lose durability when their owner dies: everything a player carries falls out where they died, and each tool loses 1 durability first. A tool that runs out breaks instead of dropping.
The damage a tool has taken is kept in its stack's data.damage, and a worn tool shows a bar under it in its slot,
going from green to red as it wears down. Upgrading a tool at the smithing table keeps its data, damage included.