CoTBlockAdvanced

A registered CoT Block. Used for advanced functionality. like onRandomTick, onReplaced etc.

These functions should be run in CraftTweaker scripts, instead of ContentTweaker ones. And they are reloadable. You can get it via advanced block BEP.

This class was added by a mod with mod-id contenttweaker. 因此,如果要使用此功能,则需要安装此mod。

导入相关包

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
Copy
import mods.contenttweaker.block.advance.CoTBlockAdvanced;

方法

setBlockColorSupplier

The block's color

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setBlockColorSupplier(func as IBlockColorSupplier) as CoTBlockAdvanced
参数类型描述
funcIBlockColorSupplierAn IBlockColorSupplier. The tintIndex argument is defined by its model
setOnActivated

Sets what will happen when a player right-clicks the block

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setOnActivated(func as IBlockActivated) as CoTBlockAdvanced
参数类型描述
funcIBlockActivatedAn IBlockActivated function, the function should return an ActionResultType
setOnAdded

Sets what will happen when the block is added.

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setOnAdded(func as IBlockAdded) as CoTBlockAdvanced
参数类型描述
funcIBlockAddedNo Description Provided
setOnNeighborChanged

Sets what will happen when a neighbour of the block is changed

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setOnNeighborChanged(func as IBlockNeighborChanged) as CoTBlockAdvanced
参数类型描述
funcIBlockNeighborChangedNo Description Provided
setOnRandomTick

Sets what will happen when the block receive a random tick. Throws an exception if the block does not tick randomly.

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setOnRandomTick(func as IBlockRandomTick) as CoTBlockAdvanced
参数类型描述
funcIBlockRandomTickNo Description Provided
setOnReplaced

Sets what will happen when the block is replaced. (Note. destroy means replace with air)

Return Type: CoTBlockAdvanced

ZenScript
Copy
CoTBlockAdvanced.setOnReplaced(func as IBlockReplaced) as CoTBlockAdvanced
参数类型描述
funcIBlockReplacedNo Description Provided