This mod is designed to expand upon the vanilla villager trading offers. It is made for modpack authors.
By default, no extra trades are added. You need to go in to the config file and add them yourself!
That being said, if you load this mod for the first time it will create an example trade for the armorer profession (which you should modify or remove).
-------
How does it work?
This mod reads json files from the "config/custom villager trades" directory. The directory will be created (with an example file) when you load the mod for the first time (and if no config files are present).
The profession modified will depend on the file name. For example, a file called 'farmer.json' will apply trades to the farmer only.
After getting the trades, it will inject in to the villager trade event provided by forge (exactly how other mods do it), the only difference is you can create the trade exactly how you want it.
The mod will perform a check on each trade to make sure they are valid. If there are any problems it will then report this on the console.
The file must be built as specified below. I have made an example file if you are unsure how to make it.
-------
Features
A fully customizable trade creation system where you can define basic or advanced trades using JSON.
Modify trades for any profession using a simple named config file (including the nitwit).
You can set "global" trades, these will be applied to any villager that can trade (call the config file "all.json")
Trades can be applied based on level.
All aspects of the trade can be modified (trade experience, discounts, etc.)
Enchantments can be applied to any trade item. This allows for whacky unique items that can't be acquired via normal (vanilla) means.
Modded item and block support.
Modded profession support - you can add trades to other people's villagers.
Remove all vanilla trades - you can do this per-profession.
Vanilla wanderer trades can be modified/replaced.
List of vanilla professions (this is what the files should be named):
all.json
armorer.json
cartographer.json
cleric.json
farmer.json
fisherman.json
fletcher.json
leatherworker.json
librarian.json
mason.json
nitwit.json
shepherd.json
toolsmith.json
weaponsmith.json
-----------------------------
The wanderer must have a separate file in a different directory, this is "config/custom trades/wanderer"
wanderer.json
-------
Warnings:
Note that this mod does not give you the option to create trades for villagers who have no profession/unemployed.
Your trade is not guaranteed to appear every time - this is because of the trade pools. You can however remove vanilla trades.
If you are unsure what the item ID is, press f3+h ingame to enable tooltips and hover over the item you want to add.
If you have any problems launching the game with a custom config, please first start the game without a config and see if it goes to the title screen. If it does then your config is not formatted correctly. There will also be an error message in the console/log if it is caused by custom villager trades.
If you remove a trade that a villager already has, the villager will still keep that trade because it is stored in the NBT.
The wanderer must have a minimum of 5 "common" and 1 "rare" trades.
-------
Config Files
For each profession, you can specify custom trades. Some fields are required and others are not. Here is an example: Example villager trade - Pastebin.com
Required fields:
profession - This MUST be defined only once, it must not be nested inside of any objects.
removeOtherTrades - This will remove other trades for this profession (works with vanilla).
isRare - This is only for the wanderer and will have no effect on other trades. Does exactly as the label indicates. True / False.
trades - This is an array of objects, each object defines a trade.
trades / offer - REQUIRED for each trade definition. See "Trade Object" below.
trades / request - REQUIRED for each trade definition. See "Trade Object" below.
trades / additionalRequest - OPTIONAL. See "Trade Object".
trades / tradeExp - REQUIRED, how much experience does the villager get for this trade (this experience is for the villager to go to the next trade level). I suggest not going below 1.
trades / maxUses - REQUIRED
trades / priceMultiplier - REQUIRED
trades / demand - REQUIRED
trades / tradeLevel - REQUIRED, at what level does this trade become available? The range is 1-5 where 1 is lowest.
Trade Object:
The below are requirements for each item defined within each 'trade object' instance.
/ itemKey - REQUIRED
/ amount - REQUIRED
/ enchantments - OPTIONAL, An object array of enchantments that can be applied, see "enchantment object" below.
/ metadata - OPTIONAL
Enchantment Object:
/ enchantmentKey - REQUIRED, this must be the key of the enchantment, example - minecraft:sharpness or minecraft:swiftness
You can now modify wanderer trades! To do this search for the folder "config/custom trades/wanderer" and create a JSON in there called "wanderer.json".
One slight difference between the wanderer trades and the existing villager trades is that you need to add a field called "isRare" and set it to either true or false.
TradeLevel does not matter for the wandering trader.
WARNING: You MUST have at least 5 common and 1 rare trade in order for this to work. If you do not, then your wander trades won't be added. If you are not removing existing wanderer trades, you do not need to worry about the above warning.
-------
Help! My trade isn't appearing!
If your config entry is not created properly, the mod will throw a warning explaining what is wrong with that entry. It will then try to add the rest of the trades. This is an example of what you would see if there is a problem:
[14:26:03] [Worker-Main-9/INFO] [customvillagertrades/]: Checking custom villager trades...
[14:26:03] [Worker-Main-9/WARN] [customvillagertrades/]: Unable to add a custom trade! Reason: item/block does not exist - dotcoinmod:ironcoin
[14:26:03] [Worker-Main-9/INFO] [customvillagertrades/]: Check complete!
If you don't know the JSON language, please take the time to learn it before coming to me with problems - it is an easy language to learn, read and understand.
-------
Do feel free to share your custom trades in the comments!
This mod is designed to expand upon the vanilla villager trading offers. It is made for modpack authors.
By default, no extra trades are added. You need to go in to the config file and add them yourself!
That being said, if you load this mod for the first time it will create an example trade for the armorer profession (which you should modify or remove).
-------
How does it work?
This mod reads json files from the "config/custom villager trades" directory. The directory will be created (with an example file) when you load the mod for the first time (and if no config files are present).
The profession modified will depend on the file name. For example, a file called 'farmer.json' will apply trades to the farmer only.
After getting the trades, it will inject in to the villager trade event provided by forge (exactly how other mods do it), the only difference is you can create the trade exactly how you want it.
The mod will perform a check on each trade to make sure they are valid. If there are any problems it will then report this on the console.
The file must be built as specified below. I have made an example file if you are unsure how to make it.
-------
Features
A fully customizable trade creation system where you can define basic or advanced trades using JSON.
Modify trades for any profession using a simple named config file (including the nitwit).
You can set "global" trades, these will be applied to any villager that can trade (call the config file "all.json")
Trades can be applied based on level.
All aspects of the trade can be modified (trade experience, discounts, etc.)
Enchantments can be applied to any trade item. This allows for whacky unique items that can't be acquired via normal (vanilla) means.
Modded item and block support.
Modded profession support - you can add trades to other people's villagers.
Remove all vanilla trades - you can do this per-profession.
Vanilla wanderer trades can be modified/replaced.
List of vanilla professions (this is what the files should be named):
all.json
armorer.json
cartographer.json
cleric.json
farmer.json
fisherman.json
fletcher.json
leatherworker.json
librarian.json
mason.json
nitwit.json
shepherd.json
toolsmith.json
weaponsmith.json
-----------------------------
The wanderer must have a separate file in a different directory, this is "config/custom trades/wanderer"
wanderer.json
-------
Warnings:
Note that this mod does not give you the option to create trades for villagers who have no profession/unemployed.
Your trade is not guaranteed to appear every time - this is because of the trade pools. You can however remove vanilla trades.
If you are unsure what the item ID is, press f3+h ingame to enable tooltips and hover over the item you want to add.
If you have any problems launching the game with a custom config, please first start the game without a config and see if it goes to the title screen. If it does then your config is not formatted correctly. There will also be an error message in the console/log if it is caused by custom villager trades.
If you remove a trade that a villager already has, the villager will still keep that trade because it is stored in the NBT.
The wanderer must have a minimum of 5 "common" and 1 "rare" trades.
-------
Config Files
For each profession, you can specify custom trades. Some fields are required and others are not. Here is an example: Example villager trade - Pastebin.com
Required fields:
Trade Object:
The below are requirements for each item defined within each 'trade object' instance.
Enchantment Object:
You can find existing vanilla trades to use as a guide here: https:\\minecraft.fandom.com\wiki\Trading#Java_Edition
-------
Wanderer Trades
You can now modify wanderer trades! To do this search for the folder "config/custom trades/wanderer" and create a JSON in there called "wanderer.json".
One slight difference between the wanderer trades and the existing villager trades is that you need to add a field called "isRare" and set it to either true or false.
TradeLevel does not matter for the wandering trader.
An example file for the wanderer can be found here: Wanderer Example - Pastebin.com
WARNING: You MUST have at least 5 common and 1 rare trade in order for this to work. If you do not, then your wander trades won't be added.
If you are not removing existing wanderer trades, you do not need to worry about the above warning.
-------
Help! My trade isn't appearing!
If your config entry is not created properly, the mod will throw a warning explaining what is wrong with that entry. It will then try to add the rest of the trades. This is an example of what you would see if there is a problem:
[14:26:03] [Worker-Main-9/INFO] [customvillagertrades/]: Checking custom villager trades...
[14:26:03] [Worker-Main-9/WARN] [customvillagertrades/]: Unable to add a custom trade! Reason: item/block does not exist - dotcoinmod:ironcoin
[14:26:03] [Worker-Main-9/INFO] [customvillagertrades/]: Check complete!
If you don't know the JSON language, please take the time to learn it before coming to me with problems - it is an easy language to learn, read and understand.
-------
Do feel free to share your custom trades in the comments!
This mod works really well with my other mod: Dot Coin Mod - CurseForge!
DOWNLOAD: https://www.curseforge.com/minecraft/mc-mods/custom-villager-trades
For those who may be interested, this mod has greatly expanded since my last post - do take a look