IBlockDropHandler

Link to iblockdrophandler

The IBlockDropHandler function is used to allow for advanced block drop handling for Blocks created with the Vanilla Factory.

Importing the class

Link to importing-the-class

You want to import the class? Here you go:

ZenScript
Copy
import mods.contenttweaker.DropHandler;

Function structure

Link to function-structure

The function is a void function that takes the following parameters:

  • ICTItemList drops.
  • IBlockAccess world -> the world we are in, possible an IWorld, you might want to instanceof and downcast
  • IBlockPos position -> the position of the block
  • ICTBlockState state -> the blockstate of the block
  • int fortune -> the fortune level of the tool used

As this method does not return anything, all drops need to be added to the drops list using the exposed methods.
Read about them here.

ZenScript
Copy
block.setDropHandler(function(drops, world, position, state, fortune) {

    drops.add(<item:minecraft:bedrock>);
    drops.add(<item:minecraft:carrot> % 50);

    return;
});