Started by
Mcreator_noob
on
Topic category: Help with Minecraft modding (Java Edition)
I want a "shockwave" to release when the player gets hit, but right now, the player also gets damage from the shockwave and the ability will just keep repeating over and over again as long as the player is missing 1 HP. Please help make it stop doing damage to the player and make it only blast once when getting the player is damaged, then after the cooldown it does it again when (and only when) the player is damaged damaged.
you could make a new damage type(e.g. Force) and make a procedure that on entity hurt/damaged and if player and was from Force, cancels it and if the entity dies, cancel it too.
Here's some images:
If damage is Force, cancel
If entity dies, cancel
Shockwave code
Use the "on entity attacked/hurt" event, check if the entity is wearing your chestplate and then run your code.
In the entity iterator, check that "Entity iterator != Event/target entity" so the player isn't damaged.
This last suggestion is just a quality thing but I would check that the Entity iterators y coordinates aren't more than 3 or so blocks off the players y coordinates. That's just to make the shockwave more flat and to stop things above and below getting hurt in annoying ways.