CoTItemAdvanced
Link to cotitemadvanced
A registered CoT Item. Used for advanced functionality. like onItemUse, onItemRightClick etc.
These functions should be run in CraftTweaker scripts, instead of ContentTweaker ones. And they are reloadable. You can get it via advanced item BEP.
This class was added by a mod with mod-id contenttweaker
. 因此,如果要使用此功能,则需要安装此mod。
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport mods.contenttweaker.item.advance.CoTItemAdvanced;
使用方式
Link to 使用方式
Name: setInventoryTick
Sets what will happen when the item is ticked in an inventory.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setInventoryTick(func as IItemInventoryTick) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemInventoryTick | 描述 an IItemInventoryTick function |
Name: setItemColorSupplier
The item's color.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setItemColorSupplier(func as IItemColorSupplier) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemColorSupplier | 描述 an IItemColorSupplier, The tintIndex is layerX property of its model. |
Name: setItemUseAction
Sets the use action of this Item.
By default, if this item is a food, the use action will be "EAT".
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setItemUseAction(func as IItemUseActionSupplier) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemUseActionSupplier | 描述 an IItemUseFinish function, the function should return the new ItemStack |
Name: setItemUseDuration
How long it takes to use or consume an item.
By default, if the use finish function is defined or the item is a food, it will be 32.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setItemUseDuration(func as IItemUseDurationSupplier) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemUseDurationSupplier | 描述 an IItemUseDurationSupplier function |
Name: setOnHitEntity
Sets what will happen when a living entity attacks other entities with this item.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setOnHitEntity(func as IItemHitEntity) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemHitEntity | 描述 an IItemHitEntity function, the function return whether can attack or not. |
Name: setOnInteractWithEntity
Sets what will happen when a player interacts (right-clicks) an entity with this item.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setOnInteractWithEntity(func as IItemInteractWithEntity) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemInteractWithEntity | 描述 an IItemInteractWithEntity function, the function should return an ActionResultType |
Name: setOnItemRightClick
Sets what will happen when the player right clicks with the item. If the item is food, then you cannot use this method as the food mechanics also use this method.
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setOnItemRightClick(func as IItemRightClick) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemRightClick | 描述 an IItemRightClick function, the function should return an ActionResultType |
Name: setOnItemUse
Sets what will happen when the player uses this item on a block
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setOnItemUse(func as IItemUse) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemUse | 描述 an IItemUse function, the function should return an ActionResultType |
Name: setOnItemUseFinish
Sets what will happen when the player finishes using this Item (like when finishing eating).
Not called when the player stops using this Item before the action is complete
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setOnItemUseFinish(func as IItemUseFinish) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemUseFinish | 描述 an IItemUseFinish function, the function should return the new ItemStack |
Name: setUsingTick
The Set function will be called each tick while using the item
Returns: the CoTItemAdvanced, used for method chaining
Return Type: CoTItemAdvanced
ZenScript CopyCoTItemAdvanced.setUsingTick(func as IItemUsingTick) as CoTItemAdvanced
参数 | 类型 | 描述 |
---|---|---|
参数 func | 类型 IItemUsingTick | 描述 an IItemUsingTick function. The count argument of function is the amount of time in tick the item has been used for continuously. |