{
    "format_version": "1.16.0",
    "minecraft:entity": {
        "description": {
            "identifier": "bd:mommy_hand_bd",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": false,
			"runtime_identifier": "minecraft:spider",
			"scripts": {
                "animate": [
                    "hand_tail_aim_con"
                ]
            },
            "animations": {
				"hand_tail_aim_con": "controller.animation.hand_tail_aim_con",
				"hand_tail_aim": "animation.hand_tail_aim2",
				"hand_tail_move": "animation.hand_tail_move"
			}
        },
        "component_groups": {
			"despawning": {
                "minecraft:type_family": {
                    "family": ["despawer", "despawer_despawning"
                    ]
                }
            },
			"tail": {
					"minecraft:spawn_entity": {
					  "entities": [{
						  "min_wait_time": 0,
						  "max_wait_time": 0,
						  "spawn_entity": "bd:mommy_hand_tail_bd",
						  "single_use": true,
						  "num_to_spawn": 1
						}
					]
				}
			},
			"reached": {
				"minecraft:variant": {
					"value": 0
				}
			},
			"not_reached": {
				"minecraft:variant": {
					"value": 1
				}
			}
		},
        "components": {
			"minecraft:behavior.nearest_attackable_target": {
                "priority": 1,
				"must_see": false,
                "within_radius": 200,
				"reselect_targets": true,
				"set_persistent": true,
                "entity_types": [{
                        "filters": {
                            "any_of": [{
                                    "test": "is_family",
                                    "subject": "other",
                                    "value": "illager"
                                }, {
                                    "test": "is_family",
                                    "subject": "other",
                                    "value": "villager"
                                }, {
                                    "test": "is_family",
                                    "subject": "other",
                                    "value": "player"
                                }
                            ]
                        },
                        "max_dist": 190
                    }
                ]
            },
			"minecraft:behavior.melee_attack": {
				"priority": 2,
				"track_target": true,
				"speed_multiplier": 1.7,
				"reach_multiplier": 0.0,
				"max_path_time" : 0.1,
				"min_path_time" : 0.01,
				"path_inner_boundary" : 32,
				"path_outer_boundary" : 64,
				"melee_fov": 360,
				"y_max_head_rotation" : 90
			},
			"minecraft:knockback_resistance": {
                "value": 10.0
            },
			"minecraft:target_nearby_sensor": {
				"inside_range": 1.0,
				"outside_range": 1.5,
				"must_see": true,
				"on_inside_range": {
					"event": "bd:reached",
					"target": "self"
				},
				"on_outside_range": {
					"event": "bd:not_reached",
					"target": "self"
				}
			},
            "minecraft:type_family": {
                "family": ["inanimate", "mommy_long", "mommy_hand"]
            },
            "minecraft:collision_box": {
                "width": 0.35,
                "height": 0.6
            },
			"minecraft:timer": {
				"looping": false,
				"time": 20,
				"time_down_event": {
					"event": "minecraft:start_despawn"
				}
			},
			"minecraft:follow_range": {
				"value": 300
			},
            "minecraft:pushable": {
                "is_pushable": false,
                "is_pushable_by_piston": false
            },
			"minecraft:attack": {
				"damage": 0
			},
			"minecraft:movement": {
				"value": 0.0
			},
			"minecraft:flying_speed": {
				"value": 0.0
			},
			"minecraft:navigation.hover": {
				"can_path_over_water": true,
				"can_pass_doors": true,
				"can_open_doors": true,
				"can_path_from_air": true
			},
			"minecraft:movement.hover": {},
			"minecraft:annotation.open_door": {},
			"minecraft:jump.static": {},
			"minecraft:can_fly": {},
            "minecraft:damage_sensor": {
				"triggers": {
					"cause": "all",
					"deals_damage": false
				}
			},
            "minecraft:health": {
                "value": 500,
                "max": 500
            },
			"minecraft:behavior.float": {
				"priority": 7
			},
			"minecraft:despawn": {
                "filters": {
                    "all_of": [{
                            "any_of": [{
                                    "test":
                                    "is_family",
                                    "subject": "self",
                                    "value": "despawer_despawning"
                                }
                            ]
                        }
                    ]
                }
            },
            "minecraft:physics": {
				"has_gravity": false
			}
        },
        "events": {
			"minecraft:entity_spawned": {
                "run_command": {
					"command": [
						"summon bd:mommy_hand_tar_bd ^^^0.1"
					],
					"target": "self"
				}
            },
			"minecraft:start_despawn": {
                "add": {
                    "component_groups": ["despawning"]
                },
				"run_command": {
					"command": [
						"event entity @e[type=bd:mommy_hand_tail_bd,c=1,r=1] bd:retract",
						"event entity @e[type=bd:mommy_hand_tar_bd,c=1] minecraft:start_despawn"
					],
					"target": "self"
				}
            },
			"bd:tail": {
                "add": {
                    "component_groups": ["tail"]
                }
            },
			"bd:reached": {
                "add": {
                    "component_groups": ["reached", "despawning"]
                },
				"run_command": {
					"command": [
						"event entity @e[type=bd:mommy_hand_tail_bd,c=1,r=1] bd:retract",
						"event entity @e[type=bd:mommy_hand_tar_bd,c=1] minecraft:start_despawn"
					],
					"target": "self"
				}
            },
			"bd:not_reached": {
                "add": {
                    "component_groups": ["not_reached"]
                }
            }
		}
    }
}