1. Wiki
  2. /Entities
  3. /minecraft:attack

minecraft:attack

Don't want to write this by hand? GodCraft sets minecraft:attack for you with a switch.Get GodCraft

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

FieldTypeDefaultDescription
damageRange [a, b]noneDamage dealt by each hit, either a fixed number or a random range. A negative value heals instead.
effect_amplifierInteger"0"Strength level of the effect given to the target. 0 is level I.
effect_durationDecimal"0.0"How many seconds the effect lasts on the target. Can be "infinite".
effect_nameStringnoneThe 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": ""
  }
}

We use cookies to improve your experience and analyse site traffic. Learn more