Merge docs for 'Carpet Mod 1.4.134 for Minecraft 24w09a'

This commit is contained in:
github-actions[bot] committed 2024-02-29 11:53:15 +00:00
1 parent 50fe2e54c9
commit f47b827049
1 file changed
+11 -8
+11 -8
View File
@@ -4257,7 +4257,8 @@ use the same scheme.
If the entity or a block doesn't have If the entity or a block doesn't have
an inventory, all API functions typically do nothing and return null. 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. Most items returned are in the form of a triple of item name, count, and the full nbt of an item. When saving an item, if the
nbt is provided, it overrides the item type provided in the name.
### `item_list(tag?)` ### `item_list(tag?)`
@@ -4370,20 +4371,22 @@ negative numbers to indicate slots counted from 'the back'.
<pre> <pre>
inventory_get(player(), 0) => null // nothing in first hotbar slot inventory_get(player(), 0) => null // nothing in first hotbar slot
inventory_get(x,y,z, 5) => ['stone', 1, {}] inventory_get(x,y,z, 5) => ['stone', 1, {id:"minecraft:stone"}]
inventory_get(player(), -1) => ['diamond_pickaxe', 1, {Damage:4}] // slightly damaged diamond pick in the offhand inventory_get(player(), -1) => ['diamond_pickaxe', 1, {components:{"minecraft:damage":4},id:"minecraft:diamond_pickaxe"}] // slightly damaged diamond pick in the offhand
</pre> </pre>
### `inventory_set(inventory, slot, count, item?, nbt?)` ### `inventory_set(inventory, slot, count, item?, nbt?)`
Modifies or sets a stack in inventory. specify count 0 to empty the slot. If item is not specified, keeps existing Modifies or sets a stack in inventory. specify count 0 to empty the slot. If item is not specified, keeps existing
item, just modifies the count. If item is provided - replaces current item. If nbt is provided - adds a tag to the item, just modifies the count. If item is provided - replaces current item. If nbt is provided - uses the tag to create the item fully
stack at slot. Returns previous stack in that slot. ignoring the item name. If nbt is provided and count is not null, the sets the custom count on the tag from the count parameter.
If count is `null` and item is `null`, an item is entirely defined by the `nbt` parameter. Returns previous stack in that slot.
<pre> <pre>
inventory_set(player(), 0, 0) => ['stone', 64, {}] // player had a stack of stone in first hotbar slot inventory_set(player(), 0, 0) => ['stone', 64, {id:"minecraft:stone"}] // player had a stack of stone in first hotbar slot
inventory_set(player(), 0, 6) => ['diamond', 64, {}] // changed stack of diamonds in player slot to 6 inventory_set(player(), 0, 6) => ['diamond', 64, {id:"minecraft:diamond"}] // changed stack of diamonds in player slot to 6
inventory_set(player(), 0, 1, 'diamond_axe','{Damage:5}') => null //added slightly damaged diamond axe to first player slot inventory_set(player(), 0, 1, 'diamond_axe','{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null //added slightly damaged diamond axe to first player slot
inventory_set(player(), 0, null, null, '{components:{"minecraft:damage":5},id:"minecraft:diamond_axe"}') => null // same effect as above
</pre> </pre>
### `inventory_find(inventory, item, start_slot?, ), inventory_find(inventory, null, start_slot?)` ### `inventory_find(inventory, item, start_slot?, ), inventory_find(inventory, null, start_slot?)`