minecraft:barter

Enables the component to drop an item as a barter exchange.

Properties

PropertyTypeDefaultWhat it does
barter_tableText""Loot table that's used to drop a random item.
cooldown_after_being_attackedInteger10Duration, 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:

Related components