Skip to main content

Get 25% OFF on your first order with BisectHosting using code "DAQEM"!

Trade With Villager

The arc:on_trade_with_villager action type is triggered when a player successfully completes a trade with a Villager or Wandering Trader.

Action Data

When this action is triggered, the following action data is made available:

Action Data TypeDescription
arc:entityRepresents an entity in the game, such as a player, mob, or item.
arc:item_stackRepresents a stack of items, including item type and quantity.
arc:trade_offerThe merchant trade offer involved in the transaction.
arc:worldRefers to the world/dimension where the action occurs.

Example

The following example rewards the player with an emerald when they trade with a Librarian.

data/my_datapack/arc/emerald_for_books.json
{
"holder": {
"type": "arc:player",
"id": "arc:player"
},
"type": "arc:on_trade_with_villager",
"conditions": [
{
"type": "arc:entity_data",
"target": "entity",
"properties": [
{
"id": "arc:villager_profession",
"value": "minecraft:librarian"
}
]
}
],
"rewards": [
{
"type": "arc:item",
"item": {
"id": "minecraft:emerald"
}
}
]
}

Compatible Condition Types

Compatible Reward Types