ArmorChange
com.jsmacrosce.jsmacros.client.api.event.impl.player.EventArmorChange
Fires when client-tick polling detects a change to one of the local player's four armor slots.
For a damage-only change, EventItemDamage fires first.
js
JsMacros.on("ArmorChange", JavaWrapper.methodToJava(function (event) {
const now = event.item.isEmpty() ? "empty" : `${event.item.getItemId()} x${event.item.getCount()}`;
const before = event.oldItem.isEmpty() ? "empty" : `${event.oldItem.getItemId()} x${event.oldItem.getCount()}`;
Chat.log(`Armor ${event.slot}: ${before} to ${now}`);
}))Constructors
new EventArmorChange
Stores the supplied slot label and wraps the current and previous raw stacks in helpers. The slot is stored verbatim without validation; either raw stack may be
null, and is passed to its helper unchanged.Parameters:
slot: supplied armor-slot label, possiblynullitem: current raw item stack, possiblynullold: previous raw item stack, possiblynull
Fields
item
The item currently in the slot. An empty slot is represented by an empty ItemStackHelper, so check isEmpty() before reading the id or the count.
oldItem
The item previously recorded for the slot by polling, represented by an empty ItemStackHelper if the slot was empty.