Dispenser Behavior Support
CraftTweaker allows you to add or remove dispenser behaviors.
Removal
Use IItemDefinition#removeDispenserBehavior
method to remove dispenser behavior of the specific item.
Addition
Use the IItemDefinition#addDispenserBehavior
method to add dispenser behavior for the specific item.
itemDef.addDispenserBehavior(IDispenserBehavior behavior, @Optional IDispenserSoundFunction soundFunction)
IDispenserBehavior
The IDispenserBehavior function defines how a Dispenser dispenses the item. It has two parameters:
source
: An IBlockSource containing some information of the dispenser.item
: The IItemStack to be dispensed.
The function must return an IItemStack as the remaining item after dispensed.
IDispenserSoundFunction
The IDispenserSoundFunction defines what sound the dispenser should play. It has an IBlockSource parameter. The function must return a DispenserSound.