Skip to content

Fix auto trader trades with additional item data#324

Draft
PsyGuy007-sys wants to merge 1 commit into
henkelmax:26.1from
PsyGuy007-sys:fix/322-auto-trader-nbt
Draft

Fix auto trader trades with additional item data#324
PsyGuy007-sys wants to merge 1 commit into
henkelmax:26.1from
PsyGuy007-sys:fix/322-auto-trader-nbt

Conversation

@PsyGuy007-sys

Copy link
Copy Markdown

What changed

  • Match auto-trader inputs with the selected offer's ItemCost predicate.
  • Extract the actual resource stored in each input slot, preserving its data components.
  • Continue to enforce components explicitly required by an offer.
  • Document the fix in the changelog.

Why

The auto trader previously converted the offer's displayed cost stack into an ItemResource and extracted it by exact resource equality. Items with additional data components, such as Productive Farming crops or the minecraft:custom_data example from #322, therefore failed to match even though vanilla villager trading accepts them.

Using ItemCost.test aligns automatic trading with MerchantOffer.satisfiedBy: additional components are allowed, while components required by the offer still have to match.

Impact

Auto traders can now consume otherwise valid trade inputs carrying additional data components. Multi-slot extraction and transactional rollback behavior are preserved.

Validation

  • ./gradlew build
  • Targeted regression check using carrots with minecraft:custom_data
  • Verified that a mismatched explicitly required component is rejected
  • Verified that an insufficient extraction is rolled back

Closes #322

@PsyGuy007-sys
PsyGuy007-sys force-pushed the fix/322-auto-trader-nbt branch from 7369a50 to a211629 Compare July 17, 2026 08:48
@henkelmax henkelmax self-assigned this Jul 17, 2026
@henkelmax

Copy link
Copy Markdown
Owner

Is this still WIP?

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