ItemPickup
com.jsmacrosce.jsmacros.client.api.event.impl.inventory.EventItemPickup
Fires while handling an item-pickup packet for the local player, before the corresponding client inventory update. To watch individual slot changes, listen for EventSlotUpdate.
js
JsMacros.on("ItemPickup", JavaWrapper.methodToJava(function (event) {
const item = event.item;
if (item.getItemID() === "minecraft:diamond") {
if (item.getCount() >= 5) {
Chat.log(`picked up ${item.getCount()} diamonds`);
}
}
}))Constructors
new EventItemPickup
Fields
item
A snapshot of the picked-up item stack, with its count set to the packet's pickup amount. Mutating it does not modify the dropped item or inventory.
Methods
toString
Returns a diagnostic string containing the event name and the stored item's string form. Calling this method throws NullPointerException if the wrapped raw stack is
null.Returns: the string in the form
%s:{"item": %s}, with the event name and item string