mojira.dev
MC-265918

Crafter can be used to bypass doLimitedCrafting gamerule

The bug

When using a world with doLimitedCrafting gamerule set to true, the crafter can bypass locked recipes.

How to reproduce

  1. Create a new world with 1.21 update experiments and cheats enabled.

  2. Run the following commands:

    /advancement grant @a from minecraft:recipes/root
    /recipe take @a *
    /gamerule doLimitedCrafting true
  3. Try to craft planks from logs using the crafting table or the survival crafting grid.
    → ❌  You cannot craft planks.

  4. 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

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.

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.

If you don’t want to link player data in Crafter, I think
Crafter cannot craft any items when doLimitedCrafting is true?

MukiTanuki

(Unassigned)

1225102

Confirmed

Expansion B

Commands, Crafting

crafter

23w42a, 23w43a, 23w43b, 23w44a, 23w45a, ..., 1.21 Release Candidate 1, 24w33a, 1.21.2 Release Candidate 1, 1.21.3, 1.21.4

Retrieved