specialPrice – Wiki Guide
This Minecraft tutorial explains all about the NBT tag called specialPrice in Minecraft Java Edition (PC/Mac).
What does the specialPrice tag do?
In Minecraft Java Edition, the specialPrice NBT tag allows you to set a special price adjustment that is applied to the first buy item when the Villager Trade Menu is opened for the first time (it then disappears and is not available for the 2nd, 3rd, 4th, etc time you access the Villager Trade menu).
If you use a negative value for the specialPrice, the price of the first buy item will be reduced by that amount ONLY the first time that the Trade Menu is opened. If you use a positive value for the specialPrice, the price of the first buy item will be increased ONLY the first time that the Trade Menu is opened.
TIP: The specialPrice NBT tag can not reduce the price of the first buy item to lower than 1 or higher than the stack size of the item. The game will automatically enforce these price limits.
Which entities use the specialPrice tag?
The specialPrice 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 specialPrice tag in Minecraft Java Edition 1.18.
In this example, we are going to summon a villager that will buy 7 emeralds and sell 3 gold blocks, with a specialPrice of -2:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains}, Offers:{Recipes:[{buy:{id:emerald,Count:7},sell:{id:gold_block,Count:3},specialPrice:-2}]}}
This is what you would see when you open the Villager Trade menu:
First Time the Trade Menu is opened
Second, Third, Fourth Time, etc.
As you can see, the first buy item which is the 7 emeralds is reduced by 2 (7-2=5 emeralds) only the first time that the trade menu is opened. Each subsequent time the trade menu is opened (ie: 2nd, 3rd, 4th, etc), the price of the first buy item is back at its original price of 7 emeralds.
specialPrice does not affect the second buy item!
Just to demonstrate that only the first buy item (and not the BuyB item) is affected by the specialPrice, let’s create a trade with 2 buy items (7 emeralds and 7 diamonds) and 1 sell item (3 gold blocks) with a specialPrice of -2:
/summon villager ~ ~1 ~ {VillagerData:{profession:farmer,level:2,type:plains}, Offers:{Recipes:[{buy:{id:emerald,Count:7},buyB:{id:diamond,Count:7}, sell:{id:gold_block,Count:3},specialPrice:-2}]}}
This is what you would see when you open the Villager Trade menu:
First Time the Trade Menu is opened
Second, Third, Fourth Time, etc.
As you can see, the specialPrice of -2 only affects the first buy item. It reduces the required emeralds by 2 (7-2=5 emeralds) but it does not affect the amount of diamonds required for the trade to complete. The amount of diamonds required is always 7 every time you open the trade menu.