ItemComponent - Tool Component Apply (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.8.0

Syntax

apply tool component to %itemstacks/itemtypes/slots%

Description

Apply a tool component to any item making it usable tool. Requires Paper 1.21.3+ See [**Tool Component**](https://minecraft.wiki/w/Data_component_format#tool) on McWiki for more details.

**Entries/Sections**: - `default_mining_speed` = The default mining speed of this tool, used if no rules override it. Defaults to 1.0. [Optional] - `damage_per_block` = The amount of durability to remove each time a block is broken with this tool. Must be a non-negative integer. [Optional] - `can_destroy_blocks_in_creative` = Whether players can break blocks while holding this tool in Creative mode. Defaults to true. [Optional] (Requires MC 1.21.5+) - `rules:` = A list of rules for the blocks that this tool has a special behavior with.

Examples

set {_i} to a stick
apply tool component to {_i}:
	default_mining_speed: 2.3
	damage_per_block: 2
	can_destroy_blocks_in_creative: false
	rules:
		apply tool rule:
			blocks: minecraft block tag "minecraft:all_signs" # Shown as a Minecraft block tag
			speed: 1.0
			correct_for_drops: true
		apply tool rule:
			blocks: stone, granite, andesite and gravel # Shown as a list of ItemTypes
			speed: 0.5
			correct_for_drops: false
give {_i} to player

View source