Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/libraries/crafter/flags.md
Original file line number Diff line number Diff line change
@@ -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:<ShapelessRecipe>}
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 :
Comment thread
edayot marked this conversation as resolved.
Outdated

| 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 :
Comment thread
edayot marked this conversation as resolved.
Outdated

| 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.
Comment thread
edayot marked this conversation as resolved.
Outdated

Copilot AI Dec 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a spelling error in "juste" which should be "just".

Suggested change
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.
The default value of 'Success of operation' is 0, which by default just 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.

Copilot uses AI. Check for mistakes.

22 changes: 17 additions & 5 deletions docs/libraries/crafter/function_tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
edayot marked this conversation as resolved.
1 change: 1 addition & 0 deletions docs/libraries/crafter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ Documentation for the implementing crafting recipes
:hidden:
data_types
function_tag
flags
```