Entity Documentation - minecraft:behavior.trade_with_player

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

Trade With Player Behavior Properties

Name Default Value Type Description Example Values
filters not set Minecraft filter Conditions that need to be met for the behavior to start. Villager v2: {"all_of":[{"all_of":[{"test":"in_water","value":false}]},{"any_of":[{"test":"on_ground","value":true},{"test":"is_sleeping","value":true}]}]}
max_distance_from_player 8 Decimal number The max distance that the mob can be from the player before exiting the goal.
priority not set Integer number As priority approaches 0, the priority is increased. The higher the priority, the sooner this behavior will be executed as a goal. Villager v2: 2, Villager: 1

Samples

Villager v2

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

Villager

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

Beachager

"minecraft:behavior.trade_with_player": {
  "priority": 2
}