IItemRightClick
Link to iitemrightclick
The IItemRightClick function can be added to an Item and will be triggered when a user does rightclick with the item selected in his primary hand.
Dieses Paket importieren
Link to dieses-paket-importieren
It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import mods.contenttweaker.IItemRightClick;
Parameters
Link to parameters
The IItemRightClick function is a function with the following parameters:
- IMutableItemStack itemStack → The item that is right-clicked
- IWorld world → The world the player is in
- ICTPlayer player → The player doing the right-click
- String hand → Either "OFF_HAND" or "MAIN_HAND"
The function needs to return either "SUCCESS"
, "PASS"
or "FAIL"
Beispiel
Link to beispiel
ZenScript CopyzsItem.itemRightClick = function(stack, world, player, hand) {
Commands.call("scoreboard players set @p name 5", player, world);
return "Pass";
};