Skip to content

Conversation

@IntegerLimit
Copy link
Contributor

@IntegerLimit IntegerLimit commented Dec 16, 2025

This PR fixes the logic behind ingredient matching of an ItemStack that contains a matcher: e.g. one that had either whenNoNbt or whenAnyNbt called on it.

The previous logic led to some serious downfalls. As an example, consider the recipe

crafting.shapedBuilder()
    .output(item('minecraft:stick') * 4)
    .matrix('B', 'B')
    .key('B', item('minecraft:enchanted_book').whenNoNbt())
    .register()

The previous logic causes success as long as the stack matches item/meta, thus the no nbt condition is ignored. Furthermore, if we place one item in, the recipe instantly triggers, ignoring the requirement of the second book, for if the matcher is set, as long as the matcher returns valid (which only checks tag), then the logic causes success.

This PR fixes this, making sure both item stack item/meta and matcher are checked. The changes were checked with a matcher set (e.g. above recipe) and ingredients in recipes without matchers set.

@brachy84 brachy84 merged commit 266c1dc into CleanroomMC:master Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants