Rename mobs mod to mcl_mobs
[MineClone/MineClone2.git] / mods / ITEMS / REDSTONE / mcl_dispensers / API.md
blob419c3ac4078c00be3f5e2c57f5797f0c1353e7cb
1 # API documentation for dispensers
3 The dispensers API allows you to add custom code which is called when a
4 particular item is dispensed.
5 Just add the `_on_dispense` function to the item definition.
6 By default, items are just thrown out as item entities.
8 ## Additional fields for item definitions
10 ### `_on_dispense(stack, pos, droppos, dropnode, dropdir)`
12 This is a function which is called when an item is dispensed by the dispenser.
13 These are the parameters:
15 * stack: Itemstack which is dispense. This is always exactly 1 item
16 * pos: Position of dispenser
17 * droppos: Position to which to dispense item
18 * dropnode: Node of droppos
19 * dropdir: Drop direction
21 By default (return value: `nil`), the itemstack is consumed by the dispenser afterwards.
22 Optionally, you can explicitly set the return value to a custom leftover itemstack.
24 ### `_dispense_into_walkable`
26 By default, items will only be dispensed into non-walkable nodes.
27 But if this value is set If `true`, the item can be dispensed into walkable nodes.