PaperMC / PaperMC/Paper

Merchant menu can resolve the wrong offer

Open
#13,695 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage upstream: vanilla version: 1.21.11
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

When a player selects a specific villager trade, the output slot should only show the result of that selected offer if the current input items satisfy that offer.

If the selected offer does not match the current inputs, the output slot should remain empty. The server should not fall back to another matching offer.

Observed/Actual behavior

A librarian had both of these offers available at the same time:

emerald + book -> enchanted book
emerald -> lantern

If I selected the enchanted book trade and placed only emerald(s) into the payment slot while leaving the second required slot empty, the output slot showed a lantern instead of remaining empty.

So the selected trade was not respected and another matching offer was resolved instead.

Image
Steps/models to reproduce
  1. Start a clean Paper server on the latest build for your Minecraft version, with no plugins and no datapacks.
  2. Get a librarian that has both of these offers available:
    emerald + book -> enchanted book
    emerald -> lantern
  3. Open the merchant UI.
  4. Select the enchanted book trade.
  5. Put only emerald(s) into the first payment slot and leave the second slot empty.
  6. Observe that the output slot shows a lantern instead of staying empty.

This appears to happen when the selected offer is the first recipe in the merchant offer list.

Plugin and Datapack List

Plugins: None
Datapacks: None

Paper version

This server is running Paper version 1.21.11-127-main@bd74bf6 (2026-03-10T02:55:23Z) (Implementing API version 1.21.11-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.11-35-9ce7072 (MC: 1.21.11)

Other

mb fix
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the librarian merchant scenario described in the issue on the specified Paper version, focusing on selecting the first offer and leaving its second payment slot empty. Trace how the selected offer and matching offers are resolved. Done when an unmatched selected offer leaves the output empty instead of showing another offer's result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.