Mojira Archive
MC-209286

A different enchanted book trade is selected when clicking on an enchanted book offer despite not having enough emeralds

When selecting a trade without having enough materials, it will still show subsequent trades the player can afford. However, if you choose a trade that's further down the list without having enough materials, it will not show trades the player can afford (intended behaviour).

To reproduce

  • Summon a villager with the following command:
    /summon villager ~ ~1 ~ {VillagerData:{profession:librarian,level:2,type:plains},PersistenceRequired:1,Offers:{Recipes:[{buy:{id:book,count:1},buyB:{id:emerald,count:10},sell:{id:diamond_hoe,count:1},rewardExp:0b,maxUses:9999999},{buy:{id:book,count:1},buyB:{id:emerald,count:5},sell:{id:golden_hoe,count:1},rewardExp:0b,maxUses:9999999}]}}
  • With 1 book and 5 emeralds in your inventory, select the first trade
    -> It will show the item of the 2nd trade.

Alternatively, to do it in survival (The steps below was provided by Alex in this comment.)

  • Find a villager who offers multiple trades:
    • The first trade
      (E.g: 36 Emeralds + 1 Book => 1 Enchanted Book)
    • One or more other trades with the same first item, but at a lower cost
      (E.g.: 22 Emeralds + 1 Book => 1 Another Enchanted Book; 9 Emeralds => 1 Bookshelf)
  • Don't have enough items in your inventory to successfully buy the 1st trade offer
  • Select the first trade (it only occurs with the first trade)

Actual Behaviour

It will select the first trade for which you have enough items (E.g.: The 9 Emeralds => 1 Bookshelf if you don't have a book)

Expected Behaviour

It should not select any trade (The right side of the trade should stay empty)

Video

Minecraft 1.16.5 - Singleplayer 2021-01-29 20-06-40.mp4

Unresolved

sofia

Rowan Vollmer

2020-12-22, 11:19 PM

2024-12-08, 10:34 AM

12

9

Confirmed

Trading

1.16.4 - 1.21.41.16.4, 20w51a, 21w03a, 1.16.5 Release Candidate 1, 1.16.5, 21w07a, 1.17.1, 24w39a, 1.21.3, 1.21.4

-