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.
导入相关包
Link to 导入相关包
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"
ZenScript CopyzsItem.itemRightClick = function(stack, world, player, hand) {
Commands.call("scoreboard players set @p name 5", player, world);
return "Pass";
};