The bug
When using a world with doLimitedCrafting gamerule set to true, the crafter can bypass locked recipes.
How to reproduce
Create a new world with 1.21 update experiments and cheats enabled.
Run the following commands:
/advancement grant @a from minecraft:recipes/root
/recipe take @a *
/gamerule doLimitedCrafting true
Try to craft planks from logs using the crafting table or the survival crafting grid.
→ ❌ You cannot craft planks.Try to craft planks from logs using the crafter.
→ ✔ You can craft planks with a crafter.
Observed result
You can craft planks with a crafter even though the doLimitedCrafting gamerule is enabled.
Expected result
You cannot craft planks with a crafter while the doLimitedCrafting gamerule is enabled.
Linked issues
Comments 3
Either have a world-wide list of recipe that can be available to the auto crafter or registering who is interacting with it (even better, make people "sign" inside the block so they can add their recipes or remove them at will)
But as it is now, crafter can be a problem for some maps/datapacks.
This has the potential to break many maps, datapacks, and mc experiences.
One solution could be:
When placing the crafter the block saves the player's UUID to the block's nbt.
Block checks if the recipe is unlocked for the player matching the UUID.
If successful, the block crafts and spits out the items.