{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "nicothekid:crates_trader",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },
    "component_groups": {
      "component:crates_trader_despawnable": {
        "minecraft:despawn": {
          "despawn_from_chance": true,
          "despawn_from_inactivity": true,
          "despawn_from_simulation_edge": true,
          "remove_child_entities": false,
          "min_range_inactivity_timer": 30,
          "min_range_random_chance": 800,
          "despawn_from_distance": {
            "max_distance": 128,
            "min_distance": 32
          }
        }
      },
      "component:crates_trader_persistent": {
        "minecraft:persistent": {}
      }
    },
    "components": {
      "minecraft:balloonable": {
        "mass": 1.0
      },
      "minecraft:can_climb": {},
      "minecraft:collision_box": {
        "height": 1.8,
        "width": 0.6
      },
      "minecraft:health": {
        "value": 26,
        "max": 26
      },
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:movement": {
        "value": 0.30
      },
      "minecraft:scale": {
        "value": 1.0
      },
      "minecraft:type_family": {
        "family": [
          "crates_trader",
          "wandering_trader",
          "villager",
          "mob"
        ]
      },

      "minecraft:annotation.open_door": {},
      "minecraft:breathable": {
        "breathes_air": true,
        "breathes_lava": false,
        "breathes_solids": false,
        "breathes_water": false,
        "generates_bubbles": true,
        "inhale_time": 0,
        "suffocate_time": 0,
        "total_supply": 15
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "cause": "fall",
            "deals_damage": true,
						"damage_modifier": 0.0,
						"damage_multiplier": 1.0
          }
        ]
      },
      "minecraft:economy_trade_table": {
        "convert_trades_economy": false,
        "new_screen": true,
        "persist_trades": false,
        "show_trade_screen": true,
        "use_legacy_price_formula": false,
        "hero_demand_discount": -4,
        "max_nearby_cured_discount": -200,
        "nearby_cured_discount": -25,
        "cured_discount": [ -5, -20 ],
        "max_cured_discount": [ -25, -63 ],
        "display_name": "entity.nicothekid:crates_trader.name",
        "table": "trading/keys_crates/nicothekid_crates_trader_trades.json"
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": {
              "test": "in_lava",
              "subject": "self",
              "operator": "==",
              "value": true
            },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:jump.static": {
        "jump_power": 0.42
      },
      "minecraft:movement.basic": {
        "max_turn": 30.0
      },
      "minecraft:nameable": {
        "allow_name_tag_renaming": true,
        "always_show": false
      },
      "minecraft:navigation.walk": {
        "avoid_damage_blocks": true,
        "avoid_portals": false,
        "avoid_sun": false,
        "avoid_water": true,
        "can_breach": false,
        "can_break_doors": false,
        "can_jump": true,
        "can_open_doors": true,
        "can_open_iron_doors": false,
        "can_pass_doors": true,
        "can_path_from_air": false,
        "can_path_over_lava": false,
        "can_path_over_water": true,
        "can_sink": true,
        "can_swim": false,
        "can_walk": true,
        "can_walk_in_lava": false,
        "is_amphibious": false,
        "blocks_to_avoid": [
          {
            "tags": "query.any_tag('heated_netherrack_active')"
          },
          "minecraft:cactus",
          "minecraft:fire",
          "minecraft:flowing_lava",
          "minecraft:lava",
          "minecraft:magma",
          "minecraft:sculk",
          "minecraft:sculk_catalyst",
          "minecraft:sculk_sensor",
          "minecraft:sculk_shrieker",
          "minecraft:soul_fire",
          "minecraft:web"
        ]
      },
      "minecraft:physics": {
        "has_collision": true,
        "has_gravity": true
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },

      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.open_door": {
        "priority": 1,
        "close_door_after": true
      },
      "minecraft:behavior.restrict_open_door": {
        "priority": 2
      },
      "minecraft:behavior.avoid_mob_type": {
        "priority": 3,
        "remove_target": false,
        "avoid_target_xz": 16,
        "avoid_target_y": 7,
        "max_dist": 3.0,
        "max_flee": 10.0,
        "probability_per_strength": 1.0,
        "sprint_distance": 7.0,
        "sprint_speed_multiplier": 1.10,
        "walk_speed_multiplier": 1.10,
        "entity_types": [
          {
            "must_see": true,
            "reevaluate_description": false,
            "max_dist": 8,
            "walk_speed_multiplier": 1.10,
            "sprint_speed_multiplier": 1.10,
            "filters": {
              "any_of": [
                {
                  "test": "is_family",
                  "subject": "other",
                  "value": "monster",
                  "operator": "=="
                }
              ]
            }
          }
        ]
      },
      "minecraft:behavior.panic": {
        "priority": 4,
        "force": false,
        "ignore_mob_damage": false,
        "prefer_water": false,
        "speed_multiplier": 1.25
      },
      "minecraft:behavior.avoid_block": {
        "priority": 5,
        "search_height": 4,
        "search_range": 8,
        "sprint_speed_modifier": 1.1,
        "walk_speed_modifier": 1.0,
        "tick_interval": 2,
        "target_selection_method": "nearest",
        "target_blocks": [
          "minecraft:sculk",
          "minecraft:sculk_catalyst",
          "minecraft:sculk_sensor",
          "minecraft:sculk_shrieker"
        ]
      },
      "minecraft:behavior.trade_with_player": {
        "priority": 6
      },
      "minecraft:behavior.trade_interest": {
        "priority": 7,
        "carried_item_switch_time": 2.0,
        "cooldown": 2.0,
        "interest_time": 45.0,
        "remove_item_time": 1.0,
        "within_radius": 6.0
      },
      "minecraft:behavior.look_at_trading_player": {
        "priority": 8,
        "probability": 0.02,
        "angle_of_view_horizontal": 360,
        "angle_of_view_vertical": 360,
        "look_distance": 8.0,
        "look_time": [ 2, 4 ]
      },
      "minecraft:behavior.random_stroll": {
        "priority": 9,
        "speed_multiplier": 0.9
      },
      "minecraft:behavior.look_at_player": {
        "priority": 10,
        "probability": 0.02,
        "angle_of_view_horizontal": 360,
        "angle_of_view_vertical": 360,
        "look_distance": 8.0,
        "look_time": [ 2, 4 ]
      },
      "minecraft:behavior.random_look_around": {
        "priority": 11,
        "look_time": [ 2, 4 ]
      },
      "minecraft:behavior.look_at_entity": {
        "priority": 12,
        "probability": 0.02,
        "angle_of_view_horizontal": 360,
        "angle_of_view_vertical": 360,
        "look_distance": 4.0,
        "look_time": [ 1, 2 ],
        "filters": {
          "any_of": [
            {
              "test": "is_family",
              "subject": "other",
              "value": "mob",
              "operator": "=="
            }
          ]
        }
      },

      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"
      },
      "minecraft:loot": {
        "table": "loot_tables/keys_crates/entities/nicothekid_crates_trader.json"
      },
      "minecraft:conditional_bandwidth_optimization": {
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "add": {
          "component_groups": [
            "component:crates_trader_despawnable"
          ]
        }
      },
      "minecraft:crates_trader_from_stall": {
        "add": {
          "component_groups": [
            "component:crates_trader_persistent"
          ]
        }
      }
    }
  }
}
