User Tools

Site Tools


items:item_components:tool

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
items:item_components:tool [2024/04/19 13:27] – removed - external edit (Unknown date) 127.0.0.1items:item_components:tool [2024/04/19 13:27] (current) – ↷ Links adapted because of a move operation errorcraft
Line 1: Line 1:
 +====== 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 [[mc>Item_format/1.20.5#tool|minecraft:tool]] item stack component.
 +This item component is usually combined with [[items:item_components:damageable|minecraft:damageable]] and [[items:item_components:weapon|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 [[#rule|rules]] that determine the eventual mining speed and whether to call a loot table. | A list of [[#rule|rules]] | |
 +
 +
 +===== Example =====
 +<code javascript>
 +{
 +  "damage_per_block": 2,
 +  "rules": [
 +    {
 +      "blocks": "minecraft:cobweb",
 +      "correct_for_drops": true,
 +      "speed": 15.0
 +    },
 +    {
 +      "blocks": "#minecraft:sword_efficient",
 +      "speed": 1.5
 +    }
 +  ]
 +}
 +</code>
 +
 +
 +===== 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 ====
 +<code javascript>
 +{
 +  "blocks": "minecraft:cobweb",
 +  "speed": 15.0,
 +  "correct_for_drops": true
 +}
 +</code>