{
  "format_version": "1.21.50",
  "minecraft:entity": {
    "description": {
      "identifier": "silverlabs_nat:red_panda",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "animations": {
        "duration": "animation.silverlabs_nat.duration_10",
        "sleep_stand_controller": "controller.animation.silverlabs_nat.red_panda.sleep_stand"
      },
      "scripts": {
        "animate": [
          "sleep_stand_controller"
        ]
      },
      "properties": {
        "silverlabs_nat:is_following_owner": {
          "type": "bool",
          "default": true,
          "client_sync": false
        },
        "silverlabs_nat:red_panda_sleep": {
          "client_sync": true,
          "default": false,
          "type": "bool"
        },
        "silverlabs_nat:red_panda_energy": {
          "client_sync": false,
          "default": 1080,
          "range": [
            0,
            1080
          ],
          "type": "int"
        },
        "silverlabs_nat:red_panda_jolt_awake": {
          "client_sync": true,
          "default": false,
          "type": "bool"
        },
        "silverlabs_nat:red_panda_standing": {
          "client_sync": true,
          "default": false,
          "type": "bool"
        }
      }
    },
    "component_groups": {
      "silverlabs_nat:red_panda_awake": {
        "minecraft:movement": {
          "value": 0.2
        },
        "minecraft:navigation.walk": {
          "can_path_over_water": true,
          "avoid_water": true,
          "avoid_damage_blocks": true
        },
        "minecraft:movement.basic": {},
        "minecraft:jump.static": {},
        "minecraft:can_climb": {},
        "minecraft:behavior.float": {
          "priority": 0
        },
        "minecraft:behavior.tempt": {
          "priority": 2,
          "speed_multiplier": 1.2,
          "items": [
            "bamboo"
          ]
        },
        "minecraft:behavior.look_at_player": {
          "priority": 8,
          "look_distance": 6,
          "probability": 0.02
        },
        "minecraft:behavior.random_look_around": {
          "priority": 9
        }
      },
      "silverlabs_nat:red_panda_sleep": {
        "minecraft:damage_sensor": {
          "triggers": [
            {
              "on_damage": {
                "event": "silverlabs_nat:jolt_awake",
                "target": "self"
              },
              "deals_damage": "yes",
              "cause": "all"
            }
          ]
        },
        "minecraft:environment_sensor": {
          "triggers": [
            {
              "event": "silverlabs_nat:jolt_awake",
              "target": "self",
              "filters": {
                "all_of": [
                  {
                    "test": "bool_property",
                    "domain": "silverlabs_nat:red_panda_jolt_awake",
                    "subject": "self",
                    "value": false
                  },
                  {
                    "any_of": [
                      {
                        "test": "is_moving",
                        "subject": "self",
                        "value": true
                      },
                      {
                        "test": "in_water_or_rain",
                        "subject": "self",
                        "value": true
                      }
                    ]
                  }
                ]
              }
            }
          ]
        }
      },
      "silverlabs_nat:red_panda_wild": {
        "minecraft:tameable": {
          "probability": 0.3,
          "tame_event": {
            "event": "silverlabs_nat:on_tame",
            "target": "self"
          },
          "tame_items": [
            "bamboo"
          ]
        },
        "minecraft:behavior.avoid_mob_type": {
          "priority": 2,
          "entity_types": [
            {
              "filters": [
                {
                  "all_of": [
                    {
                      "test": "is_family",
                      "subject": "other",
                      "value": "player"
                    },
                    {
                      "test": "has_component",
                      "value": "minecraft:is_tamed",
                      "subject": "self",
                      "operator": "!="
                    }
                  ]
                }
              ],
              "max_dist": 8,
              "walk_speed_multiplier": 1,
              "sprint_speed_multiplier": 1.5
            }
          ]
        }
      },
      "silverlabs_nat:red_panda_tamed": {
        "minecraft:is_tamed": {},
        "minecraft:healable": {
          "items": [
            {
              "item": "bamboo",
              "heal_amount": 2
            }
          ]
        },
        "minecraft:behavior.random_stroll": {
          "priority": 3,
          "speed_multiplier": 1
        },
        "minecraft:sittable": {},
        "minecraft:behavior.stay_while_sitting": {
          "priority": 0
        }
      },
      "silverlabs_nat:follow_owner": {
        "minecraft:behavior.follow_owner": {
          "priority": 7,
          "speed_multiplier": 1.2,
          "start_distance": 10,
          "stop_distance": 3
        },
        "minecraft:behavior.random_stroll": {
          "priority": 8
        }
      },
      "silverlabs_nat:wander_around": {
        "minecraft:behavior.random_stroll": {
          "priority": 8
        }
      },
      "silverlabs_nat:baby": {
        "minecraft:is_baby": {},
        "minecraft:scale": {
          "value": 0.5
        },
        "minecraft:ageable": {
          "duration": 1200,
          "feed_items": [
            "bamboo"
          ],
          "grow_up": {
            "event": "silverlabs_nat:ageable_grow_up",
            "target": "self"
          }
        },
        "minecraft:behavior.panic": {
          "priority": 5,
          "speed_multiplier": 1.4
        },
        "minecraft:behavior.follow_parent": {
          "priority": 6,
          "speed_multiplier": 1.1
        },
        "minecraft:behavior.move_to_block": {
          "priority": 8,
          "start_chance": 0.2,
          "search_range": 32,
          "goal_radius": 0.25,
          "stay_duration": 3,
          "target_selection_method": "random",
          "on_reach": {
            "event": "silverlabs_nat:start_sniff",
            "target": "self"
          },
          "target_blocks": [
            "minecraft:poppy",
            "minecraft:dandelion",
            "minecraft:blue_orchid",
            "minecraft:allium",
            "minecraft:azure_bluet",
            "minecraft:orange_tulip",
            "minecraft:pink_tulip",
            "minecraft:red_tulip",
            "minecraft:white_tulip",
            "minecraft:oxeye_daisy",
            "minecraft:cornflower",
            "minecraft:lily_of_the_valley",
            "minecraft:sunflower",
            "minecraft:lilac",
            "minecraft:rose_bush",
            "minecraft:peony",
            "minecraft:pitcher_plant",
            "minecraft:pink_petals",
            "minecraft:wildflowers",
            "minecraft:torchflower",
            "minecraft:closed_eyeblossom",
            "minecraft:open_eyeblossom"
          ]
        },
        "minecraft:behavior.follow_mob": {
          "priority": 6,
          "search_range": 16,
          "stop_distance": 5,
          "speed_multiplier": 1.1,
          "use_home_position_restriction": true,
          "filters": {
            "all_of": [
              {
                "test": "is_underwater",
                "subject": "other",
                "value": false
              },
              {
                "test": "is_baby",
                "subject": "other",
                "value": false
              },
              {
                "any_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "silverlabs_nat:butterfly"
                  },
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "butterfly"
                  }
                ]
              }
            ]
          }
        }
      },
      "silverlabs_nat:adult_hitbox": {
        "minecraft:collision_box": {
          "width": 0.7,
          "height": 0.6
        }
      },
      "silverlabs_nat:adult": {
        "minecraft:experience_reward": {
          "on_death": "q.last_hit_by_player ? Math.random(1, 3): 0",
          "on_bred": "Math.Random(1,7)"
        },
        "minecraft:loot": {
          "table": "loot_tables/sf/nba/entities/red_panda.loot.json"
        },
        "minecraft:behavior.breed": {
          "priority": 1,
          "speed_multiplier": 1
        },
        "minecraft:breedable": {
          "require_tame": true,
          "inherit_tamed": true,
          "breeds_with": {
            "mate_type": "silverlabs_nat:red_panda",
            "baby_type": "silverlabs_nat:red_panda",
            "breed_event": {
              "event": "silverlabs_nat:from_breeding",
              "target": "baby"
            }
          },
          "breed_items": [
            "bamboo"
          ]
        }
      },
      "silverlabs_nat:natural_despawn": {
        "minecraft:despawn": {
          "despawn_from_distance": {},
          "remove_child_entities": true
        }
      },
      "silverlabs_nat:persistent": {
        "minecraft:persistent": {}
      }
    },
    "components": {
      "minecraft:behavior.beg": {
        "priority": 9,
        "look_distance": 8,
        "look_time": 4,
        "items": [
          "bamboo"
        ]
      },
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:type_family": {
        "family": [
          "silverlabs_nat:red_panda",
          "mob"
        ]
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0
      },
      "minecraft:nameable": {},
      "minecraft:health": {
        "value": 12,
        "max": 12
      },
      "minecraft:healable": {
        "items": [
          {
            "item": "bamboo",
            "heal_amount": 2
          }
        ]
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": {
              "test": "in_lava",
              "subject": "self",
              "operator": "==",
              "value": true
            },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:collision_box": {
        "width": 0.7,
        "height": 0.6
      },
      "minecraft:leashable": {
        "soft_distance": 4,
        "hard_distance": 6,
        "max_distance": 10
      },
      "minecraft:balloonable": {
        "mass": 0.9
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:conditional_bandwidth_optimization": {},
      "minecraft:interact": {
        "interactions": [
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  {
                    "test": "is_baby",
                    "subject": "self",
                    "value": true
                  },
                  {
                    "test": "has_equipment",
                    "subject": "other",
                    "domain": "hand",
                    "value": "silverlabs_nat:empty_knapsack"
                  }
                ]
              },
              "event": "silverlabs_nat:knapsack_swing"
            },
            "swing": true
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_equipment",
                    "subject": "other",
                    "domain": "hand",
                    "value": "silverlabs_nat:empty_knapsack"
                  }
                ]
              },
              "event": "silverlabs_nat:knapsack_no_capture"
            },
            "swing": false
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_equipment",
                    "subject": "other",
                    "domain": "hand",
                    "value": "silverlabs_nat:pacifier"
                  }
                ]
              },
              "event": "silverlabs_nat:revert_to_baby"
            },
            "use_item": false,
            "swing": true
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_component",
                    "value": "minecraft:is_tamed"
                  },
                  {
                    "test": "is_sitting",
                    "operator": "!="
                  },
                  {
                    "test": "bool_property",
                    "domain": "silverlabs_nat:is_following_owner",
                    "value": false
                  },
                  {
                    "test": "is_sneaking",
                    "subject": "other",
                    "operator": "!="
                  },
                  {
                    "any_of": [
                      {
                        "test": "has_equipment",
                        "value": "silverlabs_nat:whistle",
                        "subject": "other"
                      },
                      {
                        "test": "has_equipment",
                        "value": "sf_hba:whistle",
                        "subject": "other"
                      }
                    ]
                  }
                ]
              }
            },
            "swing": true
          },
          {
            "on_interact": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_component",
                    "value": "minecraft:is_tamed"
                  },
                  {
                    "test": "is_sitting",
                    "operator": "!="
                  },
                  {
                    "test": "bool_property",
                    "domain": "silverlabs_nat:is_following_owner",
                    "value": true
                  },
                  {
                    "test": "is_sneaking",
                    "subject": "other",
                    "operator": "!="
                  },
                  {
                    "any_of": [
                      {
                        "test": "has_equipment",
                        "value": "silverlabs_nat:whistle",
                        "subject": "other"
                      },
                      {
                        "test": "has_equipment",
                        "value": "sf_hba:whistle",
                        "subject": "other"
                      }
                    ]
                  }
                ]
              }
            },
            "swing": true
          }
        ]
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_wild"
          ]
        },
        "randomize": [
          {
            "weight": 9,
            "trigger": "silverlabs_nat:adult"
          },
          {
            "weight": 1,
            "trigger": "silverlabs_nat:entity_born"
          }
        ],
        "set_property": {
          "silverlabs_nat:red_panda_energy": "math.random(15, 1080)"
        }
      },
      "silverlabs_nat:force_sleep": {
        "set_property": {
          "silverlabs_nat:red_panda_energy": 0
        }
      },
      "silverlabs_nat:force_awake": {
        "set_property": {
          "silverlabs_nat:red_panda_energy": 1080
        }
      },
      "silverlabs_nat:jolt_awake": {
        "set_property": {
          "silverlabs_nat:red_panda_energy": "query.property('silverlabs_nat:red_panda_energy') + 60",
          "silverlabs_nat:red_panda_jolt_awake": true
        }
      },
      "silverlabs_nat:sleeping": {
        "set_property": {
          "silverlabs_nat:red_panda_sleep": true,
          "silverlabs_nat:red_panda_jolt_awake": false
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_sleep"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:red_panda_awake"
          ]
        }
      },
      "silverlabs_nat:awake": {
        "set_property": {
          "silverlabs_nat:red_panda_sleep": false,
          "silverlabs_nat:red_panda_jolt_awake": false
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_awake"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:red_panda_sleep"
          ]
        }
      },
      "silverlabs_nat:from_breeding": {
        "sequence": [
          {
            "trigger": "silverlabs_nat:entity_born"
          },
          {
            "trigger": "silverlabs_nat:on_tame"
          }
        ]
      },
      "silverlabs_nat:decrement_energy": {
        "set_property": {
          "silverlabs_nat:red_panda_energy": "query.property('silverlabs_nat:red_panda_energy') - math.random_integer(0, 3)"
        }
      },
      "silverlabs_nat:increment_energy": {
        "set_property": {
          "silverlabs_nat:red_panda_energy": "query.property('silverlabs_nat:red_panda_energy') + math.random_integer(1, 5)"
        }
      },
      "silverlabs_nat:start_standing": {
        "set_property": {
          "silverlabs_nat:red_panda_standing": true
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:red_panda_awake"
          ]
        }
      },
      "silverlabs_nat:stop_standing": {
        "set_property": {
          "silverlabs_nat:red_panda_standing": false
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_awake"
          ]
        }
      },
      "silverlabs_nat:adult": {
        "add": {
          "component_groups": [
            "silverlabs_nat:adult",
            "silverlabs_nat:red_panda_wild",
            "silverlabs_nat:wander_around"
          ]
        }
      },
      "silverlabs_nat:entity_born": {
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_wild",
            "silverlabs_nat:baby",
            "silverlabs_nat:wander_around"
          ]
        }
      },
      "silverlabs_nat:ageable_grow_up": {
        "remove": {
          "component_groups": [
            "silverlabs_nat:baby"
          ]
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:adult",
            "silverlabs_nat:adult_hitbox"
          ]
        }
      },
      "silverlabs_nat:on_tame": {
        "add": {
          "component_groups": [
            "silverlabs_nat:red_panda_tamed",
            "silverlabs_nat:follow_owner"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:red_panda_wild"
          ]
        }
      },
      "silverlabs_nat:follow_owner": {
        "add": {
          "component_groups": [
            "silverlabs_nat:follow_owner"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:wander_around"
          ]
        },
        "set_property": {
          "silverlabs_nat:is_following_owner": true
        },
        "queue_command": {
          "command": [
            "scriptevent silverlabs_nat:whistle_follow"
          ],
          "target": "self"
        }
      },
      "silverlabs_nat:wander_around": {
        "add": {
          "component_groups": [
            "silverlabs_nat:wander_around"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:follow_owner"
          ]
        },
        "set_property": {
          "silverlabs_nat:is_following_owner": false
        },
        "queue_command": {
          "command": [
            "scriptevent silverlabs_nat:whistle_wander"
          ],
          "target": "self"
        }
      },
      "silverlabs_nat:natural_despawn": {
        "add": {
          "component_groups": [
            "silverlabs_nat:natural_despawn"
          ]
        }
      },
      "silverlabs_nat:become_persistent": {
        "add": {
          "component_groups": [
            "silverlabs_nat:persistent"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:natural_despawn"
          ]
        }
      },
      "silverlabs_nat:set_permanent_baby": {
        "add": {
          "component_groups": [
            "silverlabs_nat:permanent_baby"
          ]
        },
        "queue_command": {
          "command": [
            "particle minecraft:villager_angry ~ ~2 ~",
            "playsound random.eat @p ~ ~ ~ 0.8 1.2"
          ]
        }
      },
      "silverlabs_nat:start_sniff": {
        "queue_command": {
          "command": [
            "playsound silverlabs_nat.flower_obsession.baby_sniff_small @a[r=6]"
          ]
        }
      },
      "silverlabs_nat:revert_to_baby": {
        "trigger": "silverlabs_nat:become_persistent",
        "queue_command": {
          "command": [
            "playsound silverlabs_nat.pacifier.interact @a[r=10] ~~~"
          ]
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:baby"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:adult",
            "silverlabs_nat:adult_hitbox"
          ]
        }
      },
      "silverlabs_nat:knapsack_no_capture": {}
    }
  }
}