Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers

IItemUpdate

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

Importing the package

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

script.zs
import mods.contenttweaker.IItemUpdate;

Syntax

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.
script.zs
item.onItemUpdate = function(itemStack, world, owner, slot, isSelected) {
//CODE GOES HERE!!
return;
}