The IItemUpdateFunction can be added to an Item to allow code to be executed whenever the item updates.

Импорт пакета

Link to импорт-пакета

If you ever feel the need to import this function's class, here you go:

ZenScript
Copy
import mods.contenttweaker.IItemUpdate;

We have a void function that takes the following parameters (in order)

  • An IMutableItemStack representing the item stack itself.
  • An IWorld object representing the world the action takes place in.
  • An IEntity object downcast as far as possible, so you can instanceOf up until ICTPlayer.
  • An int representing the slot the item currently is in
  • A boolean stating whether or not the item is currently selected.
ZenScript
Copy
item.onItemUpdate = function(itemStack, world, owner, slot, isSelected) {
    //CODE GOES HERE!!
    return;
}