Damage
com.jsmacrosce.jsmacros.client.api.event.impl.player.EventDamage
Fires when a call decreases the local player's health, before the incoming value is applied.
It dispatches before EventHealthChange,
which dispatches before EventEntityDamaged.
The injected event supplies a generic damage source, so source is its generic damage type ID and attacker is null.
js
JsMacros.on("Damage", JavaWrapper.methodToJava(function (event) {
Chat.log(`Took ${event.change} damage, ${event.health} hp left`);
if (4.0 >= event.health) {
Chat.log("About to die");
}
}))Constructors
new EventDamage
new EventDamage(DamageSource source, float health, float change)#Initializes the event with the supplied damage source and health values. The source's message ID is stored as
source; the causing entity is wrapped as attacker, or null when absent. A null source throws NullPointerException.Parameters:
source: damage source used to obtain its message ID and causing entityhealth: incoming health valuechange: amount of health lost
Fields
change
health
Incoming player health value, before it is applied.