minecraft:piercing_weapon
Allows an item to deal damage to all entities detected in a straight line along the user's view vector. Items with this component cannot destroy blocks, as the attack action always takes priority, regardless of what the user is looking at.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
reach | Object | {"max": 3, "min": 0} | Defines the range (in blocks) along the user's view vector where entities can be hit. Only targets within this distance are considered. Block collisions between the user and target block damage and its effects. |
min | Decimal | 0 | |
max | Decimal | 0 | |
creative_reach | Object | — | Defines the reach used when the user is in Creative Mode. Defaults to "reach" if unspecified. |
min | Decimal | 0 | |
max | Decimal | 0 | |
hitbox_margin | Decimal | 0 | Added tolerance to the view vector raycast for detecting entity collisions. |
Example from the game files
This is how vanilla copper_spear uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:piercing_weapon": {
"reach": {
"min": 2.0,
"max": 4.5
},
"creative_reach": {
"min": 2.0,
"max": 7.5
},
"hitbox_margin": 0.25
}
}Used by 7
Vanilla items with minecraft:piercing_weapon in their definition:
copper_speardiamond_speargolden_speariron_spearnetherite_spearstone_spearwooden_spear