minecraft:piercing_weapon for you with a switch.Get GodCraftOverview
minecraft:piercing_weapon is an item component: it goes in the components object of a custom item. Makes an attack hit every mob in a straight line in front of the user, like a spear thrust. Items with this cannot break blocks, because attacking always comes first.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
reach | FloatRange | {"max":3,"min":0} | How far ahead (in blocks) targets can be hit. Blocks in the way stop the hit. |
creative_reach | FloatRange | none | Reach used in Creative mode. Uses reach if left out. |
hitbox_margin | number | 0 | Extra room around the aim line, so targets slightly off center still count. |
Example
Inside the components object of BP/items/<name>.json (values are the defaults or placeholders):
BP/items/<name>.json
{
"minecraft:piercing_weapon": {
"reach": {
"max": 3,
"min": 0
},
"creative_reach": 1,
"hitbox_margin": 0
}
}