yarn
yarn copied to clipboard
TradeOffers.BuyItemFactory price -> buyAmount
The price
field in TradeOffers.BuyForOneEmeraldFactory
seems to be wrong. It actually represents the amount of items the Villager wants of a certain type-- for example, in this trade:
The farmer wants 6 pumpkins. This is defined in
TradeOffers
:
new BuyForOneEmeraldFactory(Blocks.PUMPKIN, 6, 12, 10)
6 is the quantity bought, 12 is the number of trades allowed before it is blocked (maxUses
, correct), and 10 is the XP gained by the villager (experience
, correct, but may be better as experienceGained
). The second argument is stored to the price
field, and is then passed into the wanted ItemStack constructor as count.
Something like buyAmount
, purchaseAmount
, or wantedQuantity
would be better.
I would not say the name is completely wrong - the price of an emerald is 6 pumpkins - but it is a bit unclear. I would personally vote for wantedQuantity
.