Overview
minecraft:attack is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Sets how much damage the entity's melee hit does, and can add a potion effect to the target. AI attack goals use it.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
damage | Range [a, b] | none | Damage dealt by each hit, either a fixed number or a random range. A negative value heals instead. |
effect_amplifier | Integer | "0" | Strength level of the effect given to the target. 0 is level I. |
effect_duration | Decimal | "0.0" | How many seconds the effect lasts on the target. Can be "infinite". |
effect_name | String | none | The effect put on the target when hit, for example poison or wither. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:attack": {
"damage": {},
"effect_amplifier": "0",
"effect_duration": "0.0",
"effect_name": ""
}
}