minecraft:barter
Enables the component to drop an item as a barter exchange.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
barter_table | Text | "" | Loot table that's used to drop a random item. |
cooldown_after_being_attacked | Integer | 10 | Duration, in seconds, for which mob won't barter items if it was hurt. |
Example from the game files
This is how vanilla Piglin uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:barter": {
"barter_table": "loot_tables/entities/piglin_barter.json",
"cooldown_after_being_attacked": 20
}
}Used by 1
Vanilla entities with minecraft:barter in their definition: