User Tools

Site Tools


items:item_components:tool

minecraft:tool

The minecraft:tool item component allows a player to mine blocks at different rates, and whether those mined blocks call their loot table after being broken, based on a set of rules. Its values may be overridden for a specific item stack by using the minecraft:tool item stack component. This item component is usually combined with minecraft:damageable and minecraft:weapon.

Fields

Name Description Type Default Value
damage_per_block The damage applied to the item after breaking a block. An optional, non-negative integer 1
default_mining_speed The mining speed used when no rules are applied. An optional float 1.0
rules A list of rules that determine the eventual mining speed and whether to call a loot table. A list of rules

Example

{
  "damage_per_block": 2,
  "rules": [
    {
      "blocks": "minecraft:cobweb",
      "correct_for_drops": true,
      "speed": 15.0
    },
    {
      "blocks": "#minecraft:sword_efficient",
      "speed": 1.5
    }
  ]
}

Rule

A rule that determines the mining speed and whether a loot tale for the mined block is called or not.

Fields

Name Description Type Default Value
blocks The blocks to determine whether to apply the rule. A block, list of blocks or block tag
speed The mining speed used when this rule is applied. An optional, positive float. If omitted, no change to this rule is applied.
correct_for_drops Whether to call the loot table or not after breaking a block. An optional boolean. If omitted, no change to this rule is applied.

Example

{
  "blocks": "minecraft:cobweb",
  "speed": 15.0,
  "correct_for_drops": true
}
items/item_components/tool.txt · Last modified: 2024/04/19 15:27 by errorcraft