ItemComponent - Attack Range Component Apply (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.16.0

Syntax

apply attack range component to %itemstacks/itemtypes/slots%

Description

Enables a custom attack range when using the item. See [**Attack Range Component**](https://minecraft.wiki/w/Data_component_format#attack_range) on McWiki for more details. Requires Minecraft 1.21.11+

**ENTRIES**: All entries are optional and will use their defaults when omitted. - `min_reach` = The minimum distance in blocks from the attacker to the target to be considered valid. Default = 0, valid range = 0 to 64 - `max_reach` = The maximum distance in blocks from the attacker to the target to be considered valid. Default = 3, valid range = 0 to 64 - `min_creative_reach` = The minimum distance in blocks from the attacker to the target to be considered valid in creative mode. Default = 0, valid range = 0 to 64 - `max_creative_reach` = The maximum distance in blocks from the attacker to the target to be considered valid in creative mode. Default = 5, valid range = 0 to 64 - `hitbox_margin` = Tthe margin applied to the target bounding box when checking for valid hitbox collision. Default = 0.3, valid range = 0 to 1 - `mob_factor` = The multiplier applied to the min_range and max_range when checking for valid distance when item is used by a mob. Default = 1, valid range = 0 to 2

Examples

set {_i} to 1 of diamond shovel
apply attack range component to {_i}:
	min_reach: 0.0
	max_reach: 64.0
	min_creative_reach: 0
	max_creative_reach: 64
	hitbox_margin: 0.3
	mob_factor: 1

give player 1 of {_i}

View source