minecraft:behavior.trade_with_player

Allows the player to trade with this mob. When the goal starts, it will stop the mob's navigation.

Properties

PropertyTypeDefaultWhat it does
filtersObject or List of object{"AND": null, "NOT": null, "OR": null, "all": null, "all_…Conditions that need to be met for the behavior to start.
testText—The name of the test to apply.
subjectBoolean or Integer or Decimal or Text—The subject of this filter test.
operatorBoolean or Integer or Decimal or Text—The comparison to apply with 'value'.
domainBoolean or Integer or Decimal or Text—The domain the test should be performed in.
valueBoolean or Integer or Decimal or Text—The value being compared with the test.
max_distance_from_playerDecimal8The max distance that the mob can be from the player before exiting the goal.
priorityIntegermin 00
control_flagsList of text[]

Example from the game files

This is how vanilla Villager uses it in Minecraft Bedrock 1.26.60.5:

{
  "minecraft:behavior.trade_with_player": {
    "filters": {
      "all_of": [
        {
          "all_of": [
            {
              "test": "in_water",
              "value": false
            }
          ]
        },
        {
          "any_of": [
            {
              "test": "on_ground",
              "value": true
            },
            {
              "test": "is_sleeping",
              "value": true
            }
          ]
        }
      ]
    },
    "priority": 1
  }
}

Used by 3

Vanilla entities with minecraft:behavior.trade_with_player in their definition:

Related components