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

IBlockAction

The IBlockAction function can be added to a Block and, depending on where you added it, will be triggered when the block is placed or broken.

Importing the package

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.IBlockAction;

Parameters

The IBlockAction is a function with the following parameters:

  • IWorld world → The world the block is in
  • IBlockPos position → The Block’s position
  • ICTBlockState state → Contains information on the block, such as the Block itself and its metadata

The function doesn’t have a return value!

Example

script.zs
zsBlock.onBlockBreak = function(world, blockPos, blockState){
print("I WAS PLACED!!!");
}