Allow some exceptions to be handled
This commit is contained in:
20 files changed
+283
-78
No files matched your search
@@ -28,14 +28,16 @@ an inventory, all API functions typically do nothing and return null.
|
||||
|
||||
Most items returned are in the form of a triple of item name, count, and nbt or the extra data associated with an item.
|
||||
|
||||
### item_list(tag?)
|
||||
### `item_list(tag?)`
|
||||
|
||||
With no arguments, returns a list of all items in the game. With an item tag provided, list items matching the tag, or `null` if tag is not valid.
|
||||
|
||||
### item_tags(item, tag?)
|
||||
### `item_tags(item, tag?)`
|
||||
|
||||
Returns list of tags the item belongs to, or, if tag is provided, `true` if an item maches the tag, `false` if it doesn't and `null` if that's not a valid tag
|
||||
|
||||
Throws `unknown_item` if item doesn't exist.
|
||||
|
||||
### `stack_limit(item)`
|
||||
|
||||
Returns number indicating what is the stack limit for the item. Its typically 1 (non-stackable), 16 (like buckets),
|
||||
@@ -43,6 +45,8 @@ or 64 - rest. It is recommended to consult this, as other inventory API function
|
||||
it is up to the programmer to keep it at bay. As of 1.13, game checks for negative numbers and setting an item to
|
||||
negative is the same as empty.
|
||||
|
||||
Throws `unknown_item` if item doesn't exist.
|
||||
|
||||
<pre>
|
||||
stack_limit('wooden_axe') => 1
|
||||
stack_limit('ender_pearl') => 16
|
||||
@@ -53,6 +57,8 @@ stack_limit('stone') => 64
|
||||
|
||||
Returns the string representing the category of a given item, like `building_blocks`, `combat`, or `tools`.
|
||||
|
||||
Throws `unknown_item` if item doesn't exist.
|
||||
|
||||
<pre>
|
||||
item_category('wooden_axe') => tools
|
||||
item_category('ender_pearl') => misc
|
||||
@@ -175,6 +181,8 @@ while( (slot = inventory_find(p, 'diamond', slot)) != null, 41, drop_item(p, slo
|
||||
inventory_drop(x,y,z, 0) => 64 // removed and spawned in the world a full stack of items
|
||||
</pre>
|
||||
|
||||
Throws `unknown_item` if item doesn't exist.
|
||||
|
||||
### `inventory_remove(inventory, item, amount?)`
|
||||
|
||||
Removes amount (defaults to 1) of item from inventory. If the inventory doesn't have the defined amount, nothing
|
||||
|
||||
Reference in new issue
Block a user