Skip to content

EntityUnload ​

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

Not cancellable

Fires when an entity is removed from the client world. The reason is the removal reason's name;
the available names depend on the Minecraft version.

js
JsMacros.on("EntityUnload", JavaWrapper.methodToJava(function (event) {
 Chat.log(`${event.entity.getType()} unloaded (${event.reason})`);  
}))

Constructors ​

new EventEntityUnload ​

new EventEntityUnload(Entity e, Entity.RemovalReason reason)#
Wraps the entity and captures the removal reason as a string; it does not perform the removal. Construction throws NullPointerException if either argument is null.

Parameters:

  • e: the Minecraft entity to wrap; must not be null
  • reason: the removal reason to convert to a string; must not be null

Fields ​

entity ​

entity: EntityHelper<?>read-only#
The entity being removed from the client world.

reason ​

reason: Stringread-only#
The removal reason's name; available names depend on the Minecraft version.

Methods ​

toString ​

toString(): String#
Returns a diagnostic string containing the event name, entity helper string, and captured reason. The format is %s:{"entity": %s, "reason": "%s"}; the reason is the captured string, quoted in the output, not a newly computed enum value or serialized entity data.
Returns: the diagnostic string in the format described above