From 2fe6976f292f51a52deece4d00aa998406ff4bbb Mon Sep 17 00:00:00 2001 From: edayot Date: Sun, 28 Dec 2025 15:48:28 +0100 Subject: [PATCH] update docs --- docs/libraries/crafter/flags.md | 61 ++++++++++++++++++++++++++ docs/libraries/crafter/function_tag.md | 22 +++++++--- docs/libraries/crafter/index.md | 1 + 3 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 docs/libraries/crafter/flags.md diff --git a/docs/libraries/crafter/flags.md b/docs/libraries/crafter/flags.md new file mode 100644 index 0000000..8d1255f --- /dev/null +++ b/docs/libraries/crafter/flags.md @@ -0,0 +1,61 @@ +# Advanced remove (flags) + +Flags customize the way items are removed in the input while an item is crafted. + + +## Available flags + +| Flag Name | Behavior without flag | Behavior with flag | +| --------- | ---------------- | ------------------ | +| `consume_buckets` | Filled buckets are replaced by empty buckets | Filled buckets are consumed | +| `consume_tools` | Tools durability decrease at every craft | Tools are totally consumed | + + +## Example : + +Flags have to be set when your recipe succeeds, for example in a shapeless recipe : + +```{code-block} mcfunction +:force: +execute + store result score @s smithed.data + if entity @s[scores={smithed.data=0}] + if score count smithed.data matches 2 + if data storage smithed.crafter:input {recipe:} + run function ./give_result: + loot replace block ~ ~ ~ container.16 loot example:my_craft + # Set the flags here, so that the water bucket is consumed, and the diamond axe is consumed too. + data modify storage smithed.crafter:input flags append value "consume_buckets" + data modify storage smithed.crafter:input flags append value "consume_tools" +``` +Where ShapelessRecipe is : +```SNBT +[ + {id:"minecraft:water_bucket",count:1}, + {id:"minecraft:diamond_axe",count:1} +] +``` + + +## Add a custom flag + +To create your own flag, first pick up a unique name for your flag, for example `namespace:my_flag`. And add it to your recipe like the example above. + +### `#smithed.crafter:event/advanced_remove` + +Register a function to to this function tag, this function has the following inputs : + +| Input Name | Input Type | Input Source | Input Objective/Path | +| --- | --- | --- | --- | +| 'Item to process' | entity | @s | weapon.mainhand | +| 'Flags list' | storage | smithed.crafter:input | flags | + +And you need update the following output : + +| Output Name | Output Type | Output Destination | Output Objective/Path | +| --- | --- | --- | --- | +| 'Success of operation' | score | $temp | smithed.data | +| 'Item to replace in the crafter' | entity | @s | weapon.mainhand | + +The default value of 'Success of operation' is 0, which by default juste remove one item. This whould be the default behavior if your flag is not present. If your flag is present and you want to change the item, set it to 1. + diff --git a/docs/libraries/crafter/function_tag.md b/docs/libraries/crafter/function_tag.md index c9d2604..2275a59 100644 --- a/docs/libraries/crafter/function_tag.md +++ b/docs/libraries/crafter/function_tag.md @@ -101,12 +101,24 @@ Where ShapelessRecipe is : ] ``` +## `#smithed.crafter:event/query_tags` -## Advanced uses : -A list of advanced uses of the crafter library. +By default, crafter provides all vanilla items tags, but you can add your own tags to be queried during crafting. -- [Flags](https://github.com/Smithed-MC/Libraries/blob/main/smithed_libraries/packs/crafter/data/smithed.crafter/functions/impl/block/table/crafting/output/clear_input/advanced.mcfunction) To register custom flags when crafting to use tools, empty buckets, etc... -- [Item Tags](https://github.com/Smithed-MC/Libraries/blob/main/smithed_libraries/packs/crafter/data/smithed.crafter/functions/impl/block/table/crafting/input/query_tags.mcfunction) To register custom items tags -- [Custom crafting table](https://github.com/Smithed-MC/Libraries/blob/main/smithed_libraries/packs/crafter/data/smithed.crafter/functions/impl/block/table/break/drop_item.mcfunction) To register your own crafting table. +| Input Name | Input Type | Input Source | Input Objective/Path | +| --- | --- | --- | --- | +| 'Item to process' | entity | @s | weapon.mainhand | + +### Example : +To add your own tags by adding a line like this : +```{code-block} mcfunction +execute + if items entity @s weapon.mainhand #namespace:tag_name + run data modify storage smithed.crafter:main root.temp.item_tag append value "#namespace:tag_name" +``` + +## Advanced uses : +A list of advanced uses of the crafter library. +- [Custom crafting table](https://github.com/Smithed-MC/Libraries/blob/main/smithed_libraries/packs/crafter/data/smithed.crafter/function/impl/block/table/break/drop_item.mcfunction) To register your own crafting table. diff --git a/docs/libraries/crafter/index.md b/docs/libraries/crafter/index.md index 7a3c870..6306f75 100644 --- a/docs/libraries/crafter/index.md +++ b/docs/libraries/crafter/index.md @@ -77,4 +77,5 @@ Documentation for the implementing crafting recipes :hidden: data_types function_tag +flags ```