{
  "format_version": "1.21.50",
  "minecraft:entity": {
    "description": {
      "identifier": "silverlabs_nat:firefly",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "properties": {
        "silverlabs_nat:can_glow": {
          "type": "bool",
          "default": false,
          "client_sync": true
        },
        "silverlabs_nat:on_hide": {
          "type": "bool",
          "default": false,
          "client_sync": true
        }
      }
    },
    "component_groups": {
      "silverlabs_nat:baby": {
        "minecraft:is_baby": {},
        "minecraft:physics": {
          "has_gravity": true
        },
        "minecraft:movement.basic": {},
        "minecraft:navigation.walk": {
          "can_path_over_water": false,
          "avoid_damage_blocks": true
        },
        "minecraft:behavior.random_stroll": {
          "priority": 3,
          "xz_dist": 8,
          "y_dist": 0
        },
        "minecraft:interact": {
          "interactions": [
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "test": "has_equipment",
                      "subject": "other",
                      "domain": "hand",
                      "value": "silverlabs_nat:empty_knapsack"
                    }
                  ]
                },
                "event": "silverlabs_nat:knapsack_swing"
              },
              "swing": true
            }
          ]
        }
      },
      "silverlabs_nat:adult": {
        "minecraft:flying_speed": {
          "value": 0.15
        },
        "minecraft:navigation.hover": {
          "can_path_over_water": true,
          "can_sink": false,
          "can_pass_doors": true,
          "can_path_from_air": true,
          "avoid_water": true,
          "avoid_damage_blocks": true,
          "avoid_sun": false
        },
        "minecraft:movement.hover": {},
        "minecraft:jump.static": {},
        "minecraft:can_fly": {},
        "minecraft:behavior.random_hover": {
          "priority": 2,
          "xz_dist": 8,
          "y_dist": 8,
          "y_offset": -1,
          "interval": 1,
          "hover_height": [
            1,
            4
          ]
        },
        "minecraft:behavior.float": {
          "priority": 3
        }
      },
      "silverlabs_nat:look_for_hide": {
        "minecraft:behavior.move_to_block": {
          "priority": 1,
          "tick_interval": 1,
          "start_chance": 0.5,
          "search_range": 10,
          "search_height": 4,
          "speed_modifier": 1.2,
          "goal_radius": 0.5,
          "target_selection_method": "random",
          "target_offset": [
            0,
            0,
            0
          ],
          "target_block_filters": {
            "test": "is_waterlogged",
            "subject": "block",
            "operator": "==",
            "value": false
          },
          "target_blocks": [
            "tallgrass:0",
            "tallgrass:1",
            "double_plant:2",
            "double_plant:3"
          ],
          "on_reach": {
            "event": "silverlabs_nat:find_hide_event",
            "target": "self"
          }
        },
        "minecraft:timer": {
          "looping": false,
          "time": 30,
          "time_down_event": {
            "event": "silverlabs_nat:perish"
          }
        }
      },
      "silverlabs_nat:perish": {
        "minecraft:out_of_control": {},
        "minecraft:timer": {
          "looping": false,
          "time": 0.1,
          "time_down_event": {
            "event": "silverlabs_nat:despawn"
          }
        }
      },
      "silverlabs_nat:despawn": {
        "minecraft:instant_despawn": {}
      },
      "silverlabs_nat:natural_despawn": {
        "minecraft:despawn": {
          "despawn_from_distance": {},
          "remove_child_entities": true
        }
      },
      "silverlabs_nat:persistent": {
        "minecraft:persistent": {}
      }
    },
    "components": {
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:type_family": {
        "family": [
          "silverlabs_nat:firefly",
          "silverlabs_nat:capturable_entity",
          "mob",
          "arthropod"
        ]
      },
      "minecraft:experience_reward": {
        "on_death": "query.last_hit_by_player ? Math.Random(1,3): 0"
      },
      "minecraft:loot": {
        "table": "loot_tables/sf/nba/entities/firefly.loot.json"
      },
      "minecraft:breathable": {
        "totalSupply": 15,
        "suffocateTime": 0
      },
      "minecraft:collision_box": {
        "width": 0.3,
        "height": 0.3
      },
      "minecraft:nameable": {},
      "minecraft:health": {
        "value": 6,
        "max": 6
      },
      "minecraft:healable": {
        "items": [
          {
            "item": "double_plant:4",
            "heal_amount": 2
          },
          {
            "item": "double_plant:5",
            "heal_amount": 2
          }
        ]
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "cause": "fall",
          "deals_damage": "no"
        }
      },
      "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.3
      },
      "minecraft:leashable": {
        "soft_distance": 4,
        "hard_distance": 6,
        "max_distance": 10
      },
      "minecraft:balloonable": {
        "mass": 0.5
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:conditional_bandwidth_optimization": {},
      "minecraft:game_event_movement_tracking": {
        "emit_flap": true
      },
      "minecraft:scheduler": {
        "min_delay_secs": 0,
        "max_delay_secs": 0,
        "scheduled_events": [
          {
            "filters": {
              "any_of": [
                {
                  "test": "is_daytime",
                  "value": false
                },
                {
                  "test": "light_level",
                  "operator": "<",
                  "value": 8
                }
              ]
            },
            "event": "silverlabs_nat:can_glow"
          },
          {
            "filters": {
              "none_of": [
                {
                  "test": "is_daytime",
                  "value": false
                },
                {
                  "test": "light_level",
                  "operator": "<",
                  "value": 8
                }
              ]
            },
            "event": "silverlabs_nat:cannot_glow"
          }
        ]
      },
      "minecraft:environment_sensor": {
        "triggers": [
          {
            "filters": {
              "all_of": {
                "test": "has_component",
                "value": "minecraft:behavior.move_to_block"
              },
              "any_of": [
                {
                  "test": "is_brightness",
                  "operator": "<=",
                  "value": 0.5
                },
                {
                  "test": "is_daytime",
                  "value": false
                }
              ]
            },
            "event": "silverlabs_nat:fly_around_aimlessly"
          },
          {
            "filters": [
              {
                "test": "has_component",
                "operator": "!=",
                "value": "minecraft:behavior.move_to_block"
              },
              {
                "test": "has_component",
                "operator": "!=",
                "value": "minecraft:out_of_control"
              },
              {
                "test": "is_brightness",
                "operator": ">",
                "value": 0.5
              },
              {
                "test": "is_daytime",
                "value": true
              }
            ],
            "event": "silverlabs_nat:look_for_hide"
          }
        ]
      },
      "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": "is_baby",
                    "subject": "self",
                    "value": false
                  },
                  {
                    "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": {
                "test": "has_equipment",
                "subject": "other",
                "domain": "hand",
                "value": "silverlabs_nat:capture_net"
              }
            },
            "swing": true,
            "hurt_item": 1,
            "interact_text": "action.interact.silverlabs_nat.capture_net.use",
            "play_sounds": "pop"
          }
        ]
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "add": {
          "component_groups": [
            "silverlabs_nat:adult"
          ]
        }
      },
      "silverlabs_nat:can_glow": {
        "set_property": {
          "silverlabs_nat:can_glow": true
        }
      },
      "silverlabs_nat:cannot_glow": {
        "set_property": {
          "silverlabs_nat:can_glow": false
        }
      },
      "silverlabs_nat:fly_around_aimlessly": {
        "remove": {
          "component_groups": [
            "silverlabs_nat:look_for_hide"
          ]
        }
      },
      "silverlabs_nat:look_for_hide": {
        "add": {
          "component_groups": [
            "silverlabs_nat:look_for_hide"
          ]
        }
      },
      "silverlabs_nat:find_hide_event": {
        "trigger": "silverlabs_nat:perish",
        "set_property": {
          "silverlabs_nat:on_hide": true
        }
      },
      "silverlabs_nat:perish": {
        "remove": {
          "component_groups": [
            "silverlabs_nat:look_for_hide"
          ]
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:perish"
          ]
        }
      },
      "silverlabs_nat:despawn": {
        "add": {
          "component_groups": [
            "silverlabs_nat:despawn"
          ]
        }
      },
      "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:revert_to_baby": {
        "trigger": "silverlabs_nat:become_persistent",
        "queue_command": {
          "command": [
            "playsound silverlabs_nat.pacifier.interact @a[r=10] ~~~"
          ]
        },
        "remove": {
          "component_groups": [
            "silverlabs_nat:adult"
          ]
        },
        "add": {
          "component_groups": [
            "silverlabs_nat:baby"
          ]
        }
      },
      "silverlabs_nat:knapsack_no_capture": {}
    }
  }
}