ItemComponent - Blocks Attacks Apply (Section) — SkBee

Addon: SkBee · Category: Section · Since: 3.23.0

Syntax

apply blocks attacks [component] to %itemstacks/itemtypes/slots%

Description

When present, this item can be used like a shield to block attacks to the holding player. See [**Blocks Attacks Component**](https://minecraft.wiki/w/Data_component_format#blocks_attacks) on McWiki for more info.

**Entries**: - `block_delay_seconds` = The amount of time (in seconds) that use must be held before successfully blocking attacks [optional timespan, defaults to 0 seconds]. - `disable_cooldown_scale` = The multiplier applied to the cooldown time for the item when attacked by a disabling attack [optional number, defaults to 1]. - `damage_reductions` = A section to apply a set of rules for how much and what kinds damage should be blocked in a given attack [optional]. - `item_damage_threshold` = The minimum amount of damage dealt by the attack before item damage is applied to the item [optional number, defaults to 0]. - `item_damage_base` = The constant amount of damage applied to the item, if threshold is passed [optional number, defaults to 0]. - `item_damage_factor` = The fraction of the dealt damage that should be applied to the item, if threshold is passed [optional number, defaults to 1.5]. - `block_sound` = A sound to play when the item successfully blocks an attack [optional string, defaults to none]. - `disabled_sound` = A sound to play when the item goes on its disabled cooldown due to an attack [optional string, defaults to none. - `bypassed_by` = DamageTypes that bypass the blocking [optional String/TagKey].

Examples

apply blocks attacks to {_i}:
	block_delay_seconds: 0.25 seconds
	disable_cooldown_scale: 1.5
	item_damage_threshold: 1.0
	item_damage_base: 1.0
	item_damage_factor: 3.0
	block_sound: "minecraft:item.shield.block"
	disabled_sound: "minecraft:item.shield.break"
	bypassed_by: "minecraft:bypasses_shield"
	damage_reductions:
		apply damage reduction:
			type: mob attack, campfire
			base: 1.0
			factor: 2.5
			horizontal_blocking_angle: 25

View source