Skip to content

EntityHealed ​

com.jsmacrosce.jsmacros.client.api.event.impl.world.EventEntityHealed

Since1.6.5Not cancellable

Fires before a client-side living entity's setHealth call when the supplied health is greater than its previous value. health is the supplied value and damage is the positive increase; this event does not identify the healing source.

js
JsMacros.on("EntityHealed", JavaWrapper.methodToJava(function (event) {
  if (event.entity instanceof EntityHelpers.Villager) {
    Chat.log(`Villager regained ${event.damage} health, ${event.health} hp now`);  
  }
}))

Constructors ​

new EventEntityHealed ​

new EventEntityHealed(Entity e, float health, float amount)#
Wraps the supplied entity and stores the supplied health values; it does not apply a health change.

Parameters:

  • e: non-null entity to wrap; a null value causes NullPointerException
  • health: supplied new-health value, stored unchanged without applying it
  • amount: supplied health-increase value, stored unchanged as damage; it is not validated or calculated

Fields ​

damage ​

damage: floatread-only#
Positive difference between the supplied health and the previous health.

entity ​

entity: EntityHelper<?>read-only#
Client-side living entity whose supplied health value increased.

health ​

health: floatread-only#
Health value supplied to setHealth, before it is applied.

Methods ​

toString ​

toString(): String#
Formats the event name, entity string, and stored health values as a diagnostic string.
Returns: a string in the form eventName:{"entity": entityString, "health": health, "damage": damage}