{
	"format_version": "1.16.100",
	"minecraft:entity": {
		"description": {
			"identifier": "cc_fairytales:spirit",
			"is_spawnable": true,
			"is_summonable": true,
			"is_experimental": false
		},
		"component_groups": {
			"morir":{
				"minecraft:health": {
					"value": 0
				}
			},
			"desaparecer": {
				"minecraft:scale": {
					"value": 0
				},"minecraft:timer": {
					"time": 0.1,
					"looping": true,
					"time_down_event": {
						"event": "muerte",
						"target": "self"
					}
				},
				"minecraft:loot": {
					"table": "loot_tables/chillcraft/fairy/entities/spirit.json"
				}
			},
			"spawn_diablo": {
				"minecraft:spawn_entity": {
					"entities": [
						{
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:wendygo",
							"single_use": true,
							"num_to_spawn": 1
						}
					]					
				},
				"minecraft:scale": {
					"value": 0
				},"minecraft:timer": {
					"time": 1,
					"looping": true,
					"time_down_event": {
						"event": "muerte",
						"target": "self"
					}
				}				
			}
		},
		"components": {
			"minecraft:ambient_sound_interval": {
				"event_name": "ambient",
				"range": 10,
				"value": 6
			},
			"minecraft:physics": {
				"has_gravity": false
			},
			"minecraft:pushable": {
				"is_pushable": false
			},
			"minecraft:push_through": {
				"value": 1
			},
			"minecraft:health": {
				"value": 1
			},
			"minecraft:movement": {
				"value": 0.1
			},
			"minecraft:flying_speed": {
				"value": 0.1
			},
			"minecraft:navigation.hover": {
				"can_path_over_water": true,
				"can_sink": false,
				"can_pass_doors": false,
				"can_path_from_air": true,
				"avoid_water": true,
				"avoid_damage_blocks": true,
				"avoid_sun": false
			},
			"minecraft:movement.hover": {},
			"minecraft:can_fly": {},
			"minecraft:behavior.random_look_around": {
				"priority": 8
			},
			"minecraft:behavior.random_hover": {
				"priority": 9,
				"xz_dist": 8,
				"y_dist": 8,
				"y_offset": -1,
				"interval": 1,
				"hover_height": [
					1,
					4
				]
			},
			"minecraft:target_nearby_sensor": {
				"inside_range": 5.0,
				"outside_range": 6.0,
				"must_see": true,
				"on_inside_range": {
					"event": "jugador_cerca",
					"target": "self"
				}
			},
			"minecraft:behavior.nearest_attackable_target": {
				"attack_owner": false,
				"must_reach": false,
				"must_see": false,
				"persist_time": 0,
				"reselect_targets": false,
				"scan_interval": 10,
				"set_persistent": true,
				"target_invisible_multiplier": 0.7,
				"target_search_height": -1,
				"target_sneak_visibility_multiplier": 0.8,
				"within_radius": 0,
				"entity_types": [
					{
						"filters": {
							"test": "is_family",
							"subject": "other",
							"value": "player"
						},
						"max_dist": 30
					}
				]
			},
			
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"cause": "projectile",
						"deals_damage": true,
						"on_damage": {
							"event": "flecha_golpeada"
						}
					}
				]
			}
			
		},
		"events": {
			"jugador_cerca": {
				"randomize": [
					{
						"add": {
							"component_groups": [
								"desaparecer"
							]
						},
						"weight": 10
					},
					{
						"add": {
							"component_groups": [
								"spawn_diablo"
							]
						},
						"weight": 1
					}
				]
			},
			"muerte":{
				"add": {
					"component_groups": [
						"morir"
					]
				}
			},
			"flecha_golpeada": {
                "add": {
                    "component_groups": [
                        "spawn_diablo"
                    ]
                }
            }
		}
	}
}