priceMultiplier – Wiki Guide
This Minecraft tutorial explains all about the NBT tag called priceMultiplier in Minecraft Java Edition (PC/Mac).
What does the priceMultiplier tag do?
In Minecraft Java Edition, the priceMultiplier NBT tag allows you to set a price multiplier that is applied to the first buy item in a trade. Why is the priceMultiplier tag important? Well, the villager can increase the price of the first buy item in the trade if the priceMultiplier and demand tags are positive. The higher the priceMultiplier, the more volatile the price will be, based on the demand for that item. In other words, the higher the priceMultiplier, the more the villager will raise the price of the item when demand is high.
TIP: When the villager is raising prices based on priceMultiplier, the price of the first buy item can not exceed the stack size of the item. The game will automatically enforce this price limit.
Which entities use the priceMultiplier tag?
The priceMultiplier tag is used by the following entities in Minecraft:
Entity | Description (Minecraft Entity Value) |
Command Examples |
---|---|---|
Villager (minecraft:villager) |
Example (or NBT Tags)
|
Example
Let’s take a look at an example of how to use the priceMultiplier tag in Minecraft Java Edition 1.18.
In this example, we are going to summon two villagers. Both villagers will buy 7 emeralds and sell 3 gold blocks with a positive demand of 15. For the first villager, we will set our priceMultiplier to 0.2f which is high. For the second villager, we will set our priceMultiplier to 0.05 which is low.
First Villager with high priceMultiplier of 0.2f
Command:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains},
Offers:{Recipes:[{buy:{id:emerald,Count:7},
sell:{id:gold_block,Count:3},
priceMultiplier:0.2f,demand:15}]}}
Price Calculation:
price increase = priceMultiplier x demand x price 0.2 x 15 x 7 = 21 (price increase is 21) New price = price + price increase 7 + 21 = 28 (new price is 28)
Second Villager with low priceMultiplier of 0.05f
Command:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains},
Offers:{Recipes:[{buy:{id:emerald,Count:7},
sell:{id:gold_block,Count:3},
priceMultiplier:0.05f,demand:15}]}}
Price Calculation:
price increase = priceMultiplier x demand x price 0.05 x 15 x 7 = 5 (price increase is 5) New price = price + price increase 7 + 5 = 12 (new price is 12)
As you can see, the first villager with a priceMultipllier of 0.2f charges a higher price of 28 emeralds than the second villager with a lower priceMultiplier of 0.05f who only charges 12 emeralds. One final note: when calculating the price increase, always round down to the nearest integer value. So in the case of the second villager with the price calculation of (0.05 x 15 x 7), the exact result is 5.25, but it is then rounded down to 5.
Note:Â This example only shows the effects of the priceMultiplier changing. It does not take into account villager gossip.
priceMultiplier does not affect the second buy item!
Just to demonstrate that only the first buy item is affected by the priceMultiplier, let’s add a second buy item of 7 diamonds to each of the trades. This is what you would see when you open the Villager Trade menu:
First Villager with priceMultiplier of 0.2f
Second Villager with priceMultiplier of 0.05f
As you can see, the priceMultiplier only affects the price of the first buy item (ie: emeralds), but does not affect the price of the second buy item (ie: diamonds). In this example, the amount of diamonds required is always 7 regardless of the priceMultiplier.