-
Notifications
You must be signed in to change notification settings - Fork 1
[1.16+] On Hit Effects
Insane96 edited this page Oct 1, 2022
·
7 revisions
You can add on hit effects by using the object array on_hit_effects
.
-
on_hit_effects
: Main object-
on_attack
: A list of effects to apply when the mob attacks an entity- One On Hit Object
-
target
:- "entity": targets the mob of the json
- "other": targets the other entity
-
health_left
: The effects will apply only if the mob has percentage health below this value. (This check only applies foron_attacked
) -
chance
: Modifiable Value Object rapresenting the percentage chance (between 0 and 1) to apply the on hit effect. If omitted the effect will always be applied. -
damage_type
: if omitted the damage is applied with any damage type- "direct": effects will apply only if the damage source is direct (basically melee damage)
- "indirect": effects will apply only if the damage source is indirect (e.g. projectiles)
-
potion_effects
: a list of potion effects to apply on hit -
damage_modifier
: Modifier that applies to the damage dealt -
damage_modifier_operation
: A string value (allowed values: "add", "multiply") representing if the modifier should affect the damage additively or multiplicatively -
play_sound
: a sound effect to play when the effect applies (the same used in the /playsound command)
-
- One On Hit Object
-
on_attacked
: A list of effects to apply when the mob is attacked by an entity- [Same properties as
on_attack
]
- [Same properties as
-
- In case of
on_attack
, "target": "entity" refers to the attacking mob while inon_attacked
, "target": "entity" refers to the attacked mob. Basically "entity" always refer to the json mob. -
health_left
always refers to the json mob and to the health left after the hit.
This example makes Creeper get Speed V, Regeneration II and Resistance II for 10 secs after begin hit indirectly (e.g. from a projectile) and their health drops below 50%.
{
"mob_id": "minecraft:creeper",
"on_hit_effects": {
"on_attacked": [{
"target": "entity",
"damage_type": "indirect",
"health_left": 0.5,
"potion_effects": [
{
"id": "minecraft:speed",
"amplifier": 4,
"duration": 10
},
{
"id": "minecraft:regeneration",
"amplifier": 1,
"duration": 10
},
{
"id": "minecraft:resistance",
"amplifier": 1,
"duration": 10
}
]
}]
}
}