Trades Configuration

Trade configuration lets you decide what additional trades villagers can have.

Trade Creation

To create new custom villager trades head in the trades/ folder and add a yaml file named after the world you want your trades to be in. E.g. "survival_world_hard.yml" will make the trades configured within that file to only exist within the world named survival_world_hard.

Then add the villager profession name to let RPProfessions know which profession the villager should be in order to suggest a trade:

# The trades defined in WEAPONSMITH will only be available with weaponsmith villagers
WEAPONSMITH:
  # The rest follows

Villager Trades Configuration

Now you can add the configuration of each specific trade a villager can offer:

WEAPONSMITH:
  # The ID of the trade
  IRON_TO_SWORD:
    # The rest follows

Options

The trades (in general) section has only one option.

Trades per level

The trades per level option specifies how many additional (the ones you configure) trades should be added everytime a villager gains a level. The amount can be a range, i.e. a random amount in that range will be chosen at every level up:

trades-per-level: 1-2

When a villager first picks up a new profession then that villager levels up from level 0 to 1.

The rest of the options are trade specific, i.e. these options must be within a trade configuration section (e.g. "IRON_TO_SWORD").

Chance

The relative or absolute chance for the trade to be chosen.

An integer value means the chance is relative and a non integer value means the chance is absolute.

The plugin chooses the trades as follow: Select 'trades-per-level' trades among the trades having a relative chance (one trade can be chosen multiple times but not displayed more than once) in the villager UI) and add trades having an absolute chance that "won the dice roll".

chance: 3

Or

chance: 0.15 # 15% chance to be chosen

Or

chance: ALWAYS
# The trade will always be chosen no matter the rest of the configuration

Level

The level at which the villager must be to offer the trade:

level: 2

A value of 1 means the trade can be listed as soon as the villager gets the profession.

Max use

The maximum number of times players can use the trade before the villager runs out of that trade. When a villager runs out of a trade players must wait before using that specific trade for the villager to "replenish":

max-use: 16

Villager experience reward

How many experience points the villager gets upon trading:

villager-experience-reward: 2

Player experience reward

Whether the player should get experience upon trading:

experience-reward: true

First ingredient, second ingredient and result

The configuration for the item needed as the first (leftmost trade slot) ingredient, the second (middle trade slot) ingredient and the result (rightmost trade slot) of the trade:

first-ingredient: COAL
second-ingredient: EMERALD
result: IRON_SWORD

This can be a full item configuration as described in the Item Configuration page of this wiki as well.

Or an item from MMOItems:

first-ingredient: mi:STEEL_SWORD

Or an item from MythicMobs:

result: mm:SKELETON_KING_SWORD

Or any RPProfessions item:

second-ingredient: STEEL_INGOT

And lastly it is possible to set the item to any recipe pattern:

result: pattern:STEEL_SWORD # The villager trades a book teaching a crafting recipe

It is also possible to specify the amount of a pre-configured item:

first-ingredient:
  item: mi:MYSTERIOUS_ORB
  amount: 2

Further combinations are shown below.

Full Example

Here's an example for a weaponsmith villager:

# The villager profession. Must match one of the Minecraft villager profession
WEAPONSMITH:
  trades-per-level: 1-2
  IRON_TO_SWORD:
   # The relative chance for this trade to be chosen
    chance: 1
    # The level the villager must be to offer this trade
    level: 1
    # Number of uses before the villager is depleted
    max-use: 8
    # The left trade input slot
    first-ingredient:
      material: IRON_INGOT
      amount: 3
    # The result of the trade
    result:
      material: IRON_SWORD
      display-name: "&fSteel Sword"
      enchantments:
        unbreaking: 2
        sharpness: 1
    # Whether the player gets experience for completing that trade
    experience-reward: true
    villager-experience-reward: 2
  COAL_TO_STEEL:
    chance: 2
    level: 1
    max-use: 12
    first-ingredient:
      material: COAL
      amount: 8
    # The result is the RPProfession item named STEEL_INGOT
    result: STEEL_INGOT
    experience-reward: true
    villager-experience-reward: 1
    villager-experience-reward: 1
  COPPER_TO_EMERALD:
    chance: 2
    level: 1
    max-use: 8
    first-ingredient:
      material: COPPER_INGOT
      amount: 12
    result: EMERALD
  EMERALD_TO_STEEL:
   # This trade is always added regardless of the trades per level value
    chance: ALWAYS
    level: 2
    max-use: 4
    first-ingredient:
      material: EMERALD
      amount: 10
    # The right trade input slot
    second-ingredient:
      item: STEEL_INGOT
      amount: 8
    # The result is the pattern teaching the craft BRONZE_INGOT. See pattern section of the wiki for further information
    result: pattern:BRONZE_INGOT
    experience-reward: true
    villager-experience-reward: 1

Last updated