{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:llama",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {
      "minecraft:llama_baby": {
        "minecraft:is_baby": {
        },
        "minecraft:scale": {
          "value": 0.5
        },
        "minecraft:ageable": {
          "duration": 1200,
          "feed_items": [
            {
              "item": "wheat",
              "growth": 0.1
            },
            {
              "item": "hay_block",
              "growth": 0.9
            }
          ],
          "grow_up": {
            "event": "minecraft:ageable_grow_up",
            "target": "self"
          }
        },

        "minecraft:behavior.follow_parent": {
          "priority": 5,
          "speed_multiplier": 1.0
        }
      },

      "minecraft:llama_adult": {
        "minecraft:experience_reward": {
          "on_bred": "Math.Random(1,7)",
          "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
        },
        "minecraft:loot": {
          "table": "loot_tables/entities/llama.json"
        },
        "minecraft:collision_box": {
          "width": 0.9,
          "height": 1.87
        },
        "minecraft:behavior.breed": {
          "priority": 4,
          "speed_multiplier": 1.0
        },
        "minecraft:breedable": {
          "require_tame": true,
          "inherit_tamed": false,
          "love_filters": { "test": "is_mark_variant", "subject": "self", "operator": "!=", "value": 1 }, // Wandering Trader Llamas can't fall in love
          "breeds_with": {
            "mate_type": "minecraft:llama",
            "baby_type": "minecraft:llama",
            "breed_event": {
              "event": "minecraft:entity_born",
              "target": "baby"
            }
          },
          "breed_items": [ "hay_block" ]
        }
      },

      "minecraft:llama_wandering_trader": {
        "minecraft:mark_variant": {
          "value": 1
        },
        "minecraft:on_friendly_anger": {
          "event": "minecraft:defend_wandering_trader",
          "target": "self"
        }, 
        "minecraft:environment_sensor": {
          // If this is a Wandering Trader's llama and it was just released from its leash, make it tame
          "triggers": {
            "filters": {
              "all_of": [
                { "test": "is_leashed", "subject": "self", "value": false },
                { "test": "has_component", "subject": "self", "operator": "!=", "value" :  "minecraft:is_tamed" }
              ]
            },
            "event": "minecraft:on_tame"
          }
        },
        "minecraft:persistent": {
        }
      },

      "minecraft:strength_1": {
        "minecraft:strength": {
          "value": 1,
          "max": 5
        }
      },
      "minecraft:strength_2": {
        "minecraft:strength": {
          "value": 2,
          "max": 5
        }
      },
      "minecraft:strength_3": {
        "minecraft:strength": {
          "value": 3,
          "max": 5
        }
      },
      "minecraft:strength_4": {
        "minecraft:strength": {
          "value": 4,
          "max": 5
        }
      },
      "minecraft:strength_5": {
        "minecraft:strength": {
          "value": 5,
          "max": 5
        }
      },

      "minecraft:llama_creamy": {
        "minecraft:variant": {
          "value": 0
        }
      },
      "minecraft:llama_white": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "minecraft:llama_brown": {
        "minecraft:variant": {
          "value": 2
        }
      },
      "minecraft:llama_gray": {
        "minecraft:variant": {
          "value": 3
        }
      },

      "minecraft:llama_wild": {
        "minecraft:rideable": {
          "seat_count": 1,
          "family_types": [
            "player"
          ],
          "interact_text": "action.interact.mount",
          "seats": {
            "position": [ 0.0, 1.25, -0.3 ]
          }

        },
        "minecraft:tamemount": {
          "min_temper": 0,
          "max_temper": 30,
          "feed_text": "action.interact.feed",
          "ride_text": "action.interact.mount",
          "feed_items": [
            {
              "item": "wheat",
              "temper_mod": 3
            },
            {
              "item": "hay_block",
              "temper_mod": 6
            }
          ],
          "auto_reject_items": [
            {
              "item": "horsearmorleather"
            },
            {
              "item": "horsearmoriron"
            },
            {
              "item": "horsearmorgold"
            },
            {
              "item": "horsearmordiamond"
            },
            {
              "item": "saddle"
            }
          ],
          "tame_event": {
            "event": "minecraft:on_tame",
            "target": "self"
          }
        }
      },


      "minecraft:llama_tamed": {
        "minecraft:is_tamed": {
        },
        "minecraft:rideable": {
          "seat_count": 1,
          "crouching_skip_interact": true,
          "family_types": [
            "player"
          ],
          "interact_text": "action.interact.ride.horse",
          "seats": {
            "position": [ 0.0, 1.1, -0.2 ]
          }

        },
        "minecraft:inventory": {
          "inventory_size": 16,
          "container_type": "horse",
          "additional_slots_per_strength": 3
        },
        "minecraft:equippable": {
          "slots": [
            {
              "slot": 1,
              "item": "carpet",
              "accepted_items": [ "carpet" ]
            }
          ]
        }
      },
      "minecraft:llama_unchested": {
        "minecraft:interact": {
          "interactions": [
            {
              "play_sounds": "armor.equip_generic",
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test" :  "is_family", "subject" : "other", "value" :  "player"},
                    { "test" :  "has_equipment", "domain": "hand","subject" : "other", "value" :  "chest"}
                  ]
                },
                "event": "minecraft:on_chest",
                "target": "self"
              },
              "use_item": true,
              "interact_text": "action.interact.attachchest"
            }
          ]
        }
      },

      "minecraft:llama_chested": {
        "minecraft:is_chested": {

        }
      },

      "minecraft:llama_angry": {
        "minecraft:angry": {
          "duration": 4,
          "broadcast_anger": false,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          }
        },
        "minecraft:behavior.ranged_attack": {
          "priority": 2,
          "attack_radius": 64,
          "charge_shoot_trigger": 2,
          "charge_charged_trigger": 1
        }
      },
      "minecraft:llama_angry_wolf": {
        "minecraft:angry": {
          "duration": -1,
          "broadcast_anger": false,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          }
        },
        "minecraft:behavior.ranged_attack": {
          "priority": 2,
          "attack_radius": 64,
          "charge_shoot_trigger": 2,
          "charge_charged_trigger": 1
        }
      },
      "minecraft:llama_defend_trader": {
        "minecraft:angry": {
          "duration": 10,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          }
        },
        "minecraft:behavior.ranged_attack": {
          "priority": 2,
          "attack_radius": 64,
          "charge_shoot_trigger": 2,
          "charge_charged_trigger": 1
        }
      },

      "minecraft:in_caravan": {
        "minecraft:damage_sensor": {
          "triggers": {
            "cause": "all",
            "deals_damage": true
          }
        }
      }

    },


    "components": {
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:type_family": {
        "family": [ "llama", "mob" ]
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:nameable": {
      },
      "minecraft:mark_variant": {
        "value": 0
      },
      "minecraft:health": {
        "value": {
          "range_min": 15,
          "range_max": 30
        }
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:movement": {
        "value": 0.25
      },
      "minecraft:navigation.walk": {
        "can_path_over_water": true,
        "avoid_damage_blocks": true
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:follow_range": {
        "value": 40,
        "max": 40
      },
      "minecraft:leashable": {
        "soft_distance": 4.0,
        "hard_distance": 6.0,
        "max_distance": 10.0,
        "can_be_stolen": true
      },
      "minecraft:balloonable": {
      },
      "minecraft:healable": {
        "items": [
          {
            "item": "wheat",
            "heal_amount": 2
          },
          {
            "item": "hay_block",
            "heal_amount": 10
          }
        ]
      },
      "minecraft:shooter": {
        "def": "minecraft:llama_spit"
      },
      "minecraft:despawn": {
        "despawn_from_distance": {}
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:behavior.run_around_like_crazy": {
        "priority": 1,
        "speed_multiplier": 1.2
      },
      "minecraft:behavior.follow_caravan": {
        "priority": 3,
        "speed_multiplier": 2.1,
        "entity_count": 10,
        "entity_types": {
          "filters": { "test" :  "is_family", "subject" : "other", "value" :  "llama"}
        }
      },
      "minecraft:behavior.panic": {
        "priority": 4,
        "speed_multiplier": 1.2
      },
      "minecraft:behavior.random_stroll": {
        "priority": 6,
        "speed_multiplier": 0.7
      },
      "minecraft:behavior.look_at_player": {
        "priority": 7,
        "look_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 8
      },
      "minecraft:behavior.mount_pathing": {
        "priority": 1,
        "speed_multiplier": 1.25,
        "target_dist": 0.0,
        "track_target": true
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1,
        "hurt_owner": true
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "cause": "all",
          "deals_damage": true,
          "on_damage": {
            "filters": { "test": "in_caravan", "value": false },
            "event": "minecraft:become_angry"
          }
        }
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "attack_interval": 16,
        "entity_types": [
          {
            "filters": {
                "all_of": [
                  { "test" :  "is_family", "subject" : "other", "value" :  "wolf"},
                  { "test" :  "has_component","subject" : "other", "operator": "!=", "value" :  "minecraft:is_tamed"}
                ]
              },
            "max_dist": 10
          }
        ],
        "must_see": false,
        "must_reach": true
      },
      "minecraft:on_target_acquired": {
        "filters": {
                "all_of": [
                  { "test" :  "is_family", "subject" : "target", "value" :  "wolf"},
                  { "test" :  "has_component","subject" : "target", "operator": "!=", "value" :  "minecraft:is_tamed"}
                ]
              },
        "event": "minecraft:mad_at_wolf",
        "target": "self"
      },
      "minecraft:on_target_escape": {
        "filters": {
                "all_of": [
                  { "test" :  "is_family", "subject" : "target", "value" :  "wolf"},
                  { "test" :  "has_component","subject" : "target", "operator": "!=", "value" :  "minecraft:is_tamed"}
                ]
              },
        "event": "minecraft:on_calm",
        "target": "self"
      },
	    "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      }
    },


    "events": {
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 90,
                "trigger": "minecraft:spawn_adult"
              },
              {
                "weight": 10,
                "trigger": "minecraft:spawn_baby"
              }
            ]
          }
        ]
      },

      "minecraft:entity_born": {
        "add": {
          "component_groups": [
            "minecraft:llama_baby"
          ]
        }
      },

      "minecraft:from_wandering_trader": {
        "sequence": [
          {
            "add": {
              "component_groups": [
                "minecraft:llama_adult",
                "minecraft:llama_wandering_trader"
              ]
            }
          },
          {
            "trigger": "minecraft:add_attributes"
          }
        ]
      },

      "minecraft:ageable_grow_up": {
        "remove": {
          "component_groups": [
            "minecraft:llama_baby"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:llama_adult",
            "minecraft:llama_wild"
          ]
        }
      },

      "minecraft:on_tame": {
        "remove": {
          "component_groups": [
            "minecraft:llama_wild"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:llama_tamed",
            "minecraft:llama_unchested"
          ]
        }
      },
      "minecraft:join_caravan": {
        "add": {
          "component_groups": [
            "minecraft:in_caravan"
          ]
        }
      },
      "minecraft:leave_caravan": {
        "remove": {
          "component_groups": [
            "minecraft:in_caravan"
          ]
        }
      },
      "minecraft:mad_at_wolf": {
        "add": {
          "component_groups": [
            "minecraft:llama_angry_wolf"
          ]
        }
      },
      "minecraft:defend_wandering_trader": {
        "add": {
          "component_groups": [
            "minecraft:llama_defend_trader"
          ]
        }
      },
      "minecraft:become_angry": {
        "add": {
          "component_groups": [
            "minecraft:llama_angry"
          ]
        }
      },
      "minecraft:on_calm": {
        "remove": {
          "component_groups": [
            "minecraft:llama_angry",
            "minecraft:llama_angry_wolf",
            "minecraft:llama_defend_trader"
          ]
        }
      },

      "minecraft:on_chest": {
        "remove": {
          "component_groups": [
            "minecraft:llama_unchested"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:llama_chested"
          ]
        }
      },

      "minecraft:add_attributes": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 32,
                "add": {
                  "component_groups": [
                    "minecraft:strength_1"
                  ]
                }
              },
              {
                "weight": 32,
                "add": {
                  "component_groups": [
                    "minecraft:strength_2"
                  ]
                }
              },
              {
                "weight": 32,
                "add": {
                  "component_groups": [
                    "minecraft:strength_3"
                  ]
                }
              },
              {
                "weight": 2,
                "add": {
                  "component_groups": [
                    "minecraft:strength_4"
                  ]
                }
              },
              {
                "weight": 2,
                "add": {
                  "component_groups": [
                    "minecraft:strength_5"
                  ]
                }
              }
            ]
          },
          {
            "randomize": [
              {
                "weight": 25,
                "add": {
                  "component_groups": [
                    "minecraft:llama_creamy"
                  ]
                }
              },
              {
                "weight": 25,
                "add": {
                  "component_groups": [
                    "minecraft:llama_white"
                  ]
                }
              },
              {
                "weight": 25,
                "add": {
                  "component_groups": [
                    "minecraft:llama_brown"
                  ]
                }
              },
              {
                "weight": 25,
                "add": {
                  "component_groups": [
                    "minecraft:llama_gray"
                  ]
                }
              }
            ]
          }
        ]
      },

      "minecraft:spawn_baby": { 
        "add": {
          "component_groups": [
            "minecraft:llama_baby"
          ]
        },
        "trigger": "minecraft:add_attributes"
      },

      "minecraft:spawn_adult": {
        "add": {
          "component_groups": [
            "minecraft:llama_adult",
            "minecraft:llama_wild"
          ]
        },
        "trigger": "minecraft:add_attributes"
      }
    }
  }
}