Add dispenser API docs
This commit is contained in:
parent
fa10dc93ae
commit
4207f88266
2 changed files with 28 additions and 0 deletions
1
API.md
1
API.md
|
@ -25,6 +25,7 @@ A lot of things are possible by using one of the APIs in the mods. Note that not
|
|||
* Walls: `ITEMS/mcl_walls`
|
||||
* Beds: `ITEMS/mcl_beds`
|
||||
* Buckets: `ITEMS/mcl_buckets`
|
||||
* Dispenser support: `ITEMS/REDSTONE/mcl_dispensers`
|
||||
|
||||
## Mobs
|
||||
* Mobs: `ENTITIES/mods`
|
||||
|
|
27
mods/ITEMS/REDSTONE/mcl_dispensers/API.md
Normal file
27
mods/ITEMS/REDSTONE/mcl_dispensers/API.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
# API documentation for dispensers
|
||||
|
||||
The dispensers API allows you to add custom code which is called when a
|
||||
particular item is dispensed.
|
||||
Just add the `_on_dispense` function to the item definition.
|
||||
By default, items are just thrown out as item entities.
|
||||
|
||||
## Additional fields for item definitions
|
||||
|
||||
### `_on_dispense(stack, pos, droppos, dropnode, dropdir)`
|
||||
|
||||
This is a function which is called when an item is dispensed by the dispenser.
|
||||
These are the parameters:
|
||||
|
||||
* stack: Itemstack which is dispense. This is always exactly 1 item
|
||||
* pos: Position of dispenser
|
||||
* droppos: Position to which to dispense item
|
||||
* dropnode: Node of droppos
|
||||
* dropdir: Drop direction
|
||||
|
||||
By default (return value: `nil`), the itemstack is consumed by the dispenser afterwards.
|
||||
Optionally, you can explicitly set the return value to a custom leftover itemstack.
|
||||
|
||||
### `_dispense_into_walkable`
|
||||
|
||||
By default, items will only be dispensed into non-walkable nodes.
|
||||
But if this value is set If `true`, the item can be dispensed into walkable nodes.
|
Reference in a new issue