EntityDamaged
com.jsmacrosce.jsmacros.client.api.event.impl.world.EventEntityDamaged
Fires before a client-side living entity's health decreases through setHealth; it does not identify a damage source. health is the incoming value and damage is the difference from the previously tracked health.
js
JsMacros.on("EntityDamaged", JavaWrapper.methodToJava(function (event) {
if (event.entity instanceof EntityHelpers.Creeper) {
Chat.log(`Creeper took ${event.damage} damage; incoming health: ${event.health}`);
}
}))Constructors
new EventEntityDamaged
Wraps an entity and stores the supplied health and damage values without applying damage. A
null entity causes Objects.requireNonNull(Object) to throw NullPointerException during helper creation.Parameters:
e: non-null entity to wrap; no living-entity validation is performedhealth: supplied incoming health value; it is stored unchanged and not appliedamount: supplied decrease amount, stored unchanged asdamagewithout calculation or validation
Fields
damage
Decrease from the previously tracked health; positive.
entity
Entity whose health is decreasing.
health
Incoming health value passed to
setHealth.