{
    "format_version": "1.13.0",
    "minecraft:entity": {
        "description": {
            "identifier": "bd:huggy_hug_player",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": false,
			"scripts": {
                "animate": [
					"hug_player_time_kill",
                    "huggy_hug_player",
					"hug_player_time_kill_undead"
                ]
            },
            "animations": {
                "huggy_hug_player": "animation.huggy_hug_player",
				"hug_player_time_kill": "animation.hug_player_time_kill",
				"hug_player_time_kill_undead": "animation.hug_player_time_kill_undead"
            }
        },
        "component_groups": {
            "gone": {
                "minecraft:despawn": {}
            },
			"kill_undead": {
				"minecraft:area_attack": {
					"damage_range": 0.3,
					"damage_per_tick": 350,
					"cause": "contact",
					"entity_filter": {
						"all_of": [{
								"test": "is_family",
								"subject": "other",
								"operator": "!=",
								"value": "player"
							}, {
								"test": "is_family",
								"subject": "other",
								"operator": "!=",
								"value": "inanimate"
							}, {
								"test": "is_family",
								"subject": "other",
								"operator": "!=",
								"value": "huggy_wuggy_bd"
							}
						]
					}
				}
			}
        },
        "components": {
			"minecraft:behavior.rise_to_liquid_level": {
                "priority": 0,
                "liquid_y_offset": 0.5,
                "rise_delta": 0.05,
                "sink_delta": 0.05
            },
            "minecraft:nameable": {},
            "minecraft:type_family": {
                "family": [
                    "inanimate", "huggy_hug"
                ]
            },
            "minecraft:movement": {
                "value": 0.0
            },
            "minecraft:collision_box": {
                "width": 0.0,
                "height": 0.0
            },
			"minecraft:scheduler": {
				"scheduled_events": [
					{
						"filters": {
							"all_of": [
								{
									"test": "rider_count",
									"subject": "self",
									"operator": "==",
									"value": 0
								},
								{
									"test": "is_riding",
									"subject": "self",
									"operator": "!=",
									"value": true
								}
							]
						},
						"event": "gone"
					}
				]
			},
            "minecraft:damage_sensor": {
                "triggers": [{
                        "on_damage": {
                            "filters": {
                                "all_of": [{
                                        "test": "has_damage",
                                        "value": "fatal"
                                    }
                                ]
                            },
                            "event": "minecraft:event_spawn_dead"
                        }
                    }
                ]
            },
            "minecraft:movement.basic": {},
            "minecraft:navigation.climb": {
                "can_sink": false
            },
            "minecraft:timer": {
                "time": [
                    1.5,
                    1.6
                ],
                "looping": true,
                "time_down_event": {
                    "event": "gone",
                    "target": "self"
                }
            },
            "minecraft:fire_immune": true,
            "minecraft:knockback_resistance": {
                "value": 100
            },
            "minecraft:can_climb": {},
            "minecraft:behavior.float": {
                "priority": 0
            },
            "minecraft:health": {
                "value": 1,
                "max": 1,
				"min": 1
            },
			"minecraft:behavior.rise_to_liquid_level": {
				"priority": 0,
				"liquid_y_offset": 0.25,
				"rise_delta": 0.01,
				"sink_delta": 0.01
			},
			"minecraft:rideable": {
				"seat_count": 1,
				"seats": [
					{
						"position": [0, 0, 0],
						"lock_rider_rotation": 0
					}
				]
			},
            "minecraft:physics": {
            }
        },
        "events": {
			"minecraft:entity_spawned": {
				"run_command": {
					"command": [
						"tp @s ~~~ facing @e[type=player,tag=is_huggy,c=1]"
					],
					"target": "self"
				}
			},
            "gone": {
                "add": {
                    "component_groups": [
                        "gone"
                    ]
                }
            },
			"bd:kill_undead": {
                "add": {
                    "component_groups": [
                        "kill_undead"
                    ]
                }
            },
			"bd:unkill_undead": {
                "remove": {
                    "component_groups": [
                        "kill_undead"
                    ]
                }
            }
        }
    }
}