From b76b059f1c14d123a4c518870f35fba0c2d7f1e8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 14 May 2018 01:29:32 +0200 Subject: [PATCH] Add API docs --- API.md | 25 +++++++++++++++++++++++++ README.md | 4 ++++ 2 files changed, 29 insertions(+) create mode 100644 API.md diff --git a/API.md b/API.md new file mode 100644 index 0000000..e1addc4 --- /dev/null +++ b/API.md @@ -0,0 +1,25 @@ +# Easyvend API +Use this API if you want to make an comntainer compatible with vending and +depositing machines. + +The API only has one function: + +## `easyvend.register_chest = function(node_name, inv_list, meta_owner)` +Registers a node (called “chest”) for use with Easyvend. After calling this function, +the node will be recognized as storage for vending and depositing machines. + +Easyvend makes the following assumptions about the chest: +* It has an inventory +* The inventory does not restrict the types of items you can put and take +* The chest is owned by a player +* The owner is specified in metadata + +### Parameters +* `node_name`: Name of the chest node +* `inv_list`: Name of the inventory list for exchanging items +* `meta_owner`: Identifier of the metadata variable storing the owner name + +### Example +``` +easyvend.register_chest("example:superchest", "main", "owner") +``` diff --git a/README.md b/README.md index e7902ed..8464215 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ But it can be changed via the setting `easyvend_currency`. ## Appendix +### Developer information +If you want to a container node compatible with vending/depositing machines, +use the Easyvend API, see the file `API.md`. + ### Converting machines from `vendor` mod (experimental) This mod is able to automatically transform the vending and depositing machines from Bad\_Command\_'s Vending machines [`vendor`] mod on loading