{
	"format_version": "1.16.100",
	"minecraft:entity": {
		"description": {
			"identifier": "cc_fairytales:hydra_head",
			"is_spawnable": false,
			"is_summonable": true,
			"is_experimental": false
		},
		"component_groups": {
			"periodo_gracia": {
				"minecraft:timer": {
					"time": 0.5,
					"looping": false,
					"time_down_event": {
						"event": "preparar_muerte",
						"target": "self"
					}
				}
			},
			//error en este grupo el iniciar_timer no se aplica
			"sensor_fuera_cuerpo": {
				"minecraft:environment_sensor": {
					"triggers": [
						{
							"event": "iniciar_timer",
							"target": "self",
							"filters": {
								"test": "is_riding",
								"value": false
							}
						}
					]
				}
			},
			"sensor_muerte": {
				"minecraft:environment_sensor": {
					"triggers": [
						{
							"event": "morir",
							"target": "self",
							"filters": {
								"test": "is_riding",
								"value": false
							}
						}
					]
				}
			},
			"die": {
				"minecraft:instant_despawn": {
					"remove_child_entities": false
				}
			},
			"cabeza1": {
				"minecraft:mark_variant": {
					"value": 1
				}
			},
			"cabeza2": {
				"minecraft:mark_variant": {
					"value": 2
				},
				"minecraft:scale": {
					"value": 0.9
				}
			},
			"cabeza3": {
				"minecraft:mark_variant": {
					"value": 3
				},
				"minecraft:scale": {
					"value": 0.8
				},
				"minecraft:behavior.send_event": {
					"priority": 0,
					"event_choices": [
						{
							"min_activation_range": 0.0,
							"max_activation_range": 16.0,
							"cast_duration": 0,
							"weight": 3,
							"filters": {
								"all_of": [
									{
										"test": "is_family",
										"subject": "other",
										"value": "hydra_head"
									},
									{
										"test": "is_mark_variant",
										"subject": "other",
										"value": 2
									}
								]
							},
							"sequence": [
								{
									"event": "marcado_3"
								}
							]
						}
					]
				}
			},
			"cabeza4": {
				"minecraft:mark_variant": {
					"value": 4
				},
				"minecraft:scale": {
					"value": 0.7
				},
				"minecraft:behavior.send_event": {
					"priority": 0,
					"event_choices": [
						{
							"min_activation_range": 0.0,
							"max_activation_range": 16.0,
							"cast_duration": 0,
							"weight": 3,
							"filters": {
								"all_of": [
									{
										"test": "is_family",
										"subject": "other",
										"value": "hydra_head"
									},
									{
										"test": "is_mark_variant",
										"subject": "other",
										"value": 3
									}
								]
							},
							"sequence": [
								{
									"event": "marcado_4"
								}
							]
						}
					]
				}
			},
			"cabeza5": {
				"minecraft:mark_variant": {
					"value": 5
				},
				"minecraft:scale": {
					"value": 0.6
				},
				"minecraft:behavior.send_event": {
					"priority": 0,
					"event_choices": [
						{
							"min_activation_range": 0.0,
							"max_activation_range": 16.0,
							"cast_duration": 0,
							"weight": 3,
							"filters": {
								"all_of": [
									{
										"test": "is_family",
										"subject": "other",
										"value": "hydra_head"
									},
									{
										"test": "is_mark_variant",
										"subject": "other",
										"value": 4
									}
								]
							},
							"sequence": [
								{
									"event": "marcado_5"
								}
							]
						}
					]
				}
			},
			"summon_dos": {
				//spawnear las siguiente dos cabezas
				"minecraft:spawn_entity": {
					"entities": [
						{
							"filters": {
								"all_of": [
									{
										"test": "is_mark_variant",
										"subject": "self",
										"value": 1
									}
								]
							},
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:hydra_head",
							"spawn_event": "marcado_2",
							"single_use": true,
							"num_to_spawn": 2
						},
						{
							"filters": {
								"all_of": [
									{
										"test": "is_mark_variant",
										"subject": "self",
										"value": 2
									}
								]
							},
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:hydra_head",
							"spawn_event": "marcado_3",
							"single_use": true,
							"num_to_spawn": 2
						},
						{
							"filters": {
								"all_of": [
									{
										"test": "is_mark_variant",
										"subject": "self",
										"value": 3
									}
								]
							},
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:hydra_head",
							"spawn_event": "marcado_4",
							"single_use": true,
							"num_to_spawn": 2
						},
						{
							"filters": {
								"all_of": [
									{
										"test": "is_mark_variant",
										"subject": "self",
										"value": 4
									}
								]
							},
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:hydra_head",
							"spawn_event": "marcado_5",
							"single_use": true,
							"num_to_spawn": 2
						},
						{
							"filters": {
								"all_of": [
									{
										"test": "is_mark_variant",
										"subject": "self",
										"value": 5
									}
								]
							},
							"min_wait_time": 0,
							"max_wait_time": 0,
							"spawn_entity": "cc_fairytales:hydra_head",
							"spawn_event": "marcado_5",
							"single_use": true,
							"num_to_spawn": 2
						}
					]
				},
				"minecraft:instant_despawn": {
					"remove_child_entities": false
				}
			}
		},
		"components": {
			"minecraft:type_family": {
				"family": ["hydra_head", "undead"]
			},
			"minecraft:mark_variant": {
				"value": 0
			},
			"minecraft:physics": {
				"has_gravity": true,
				"has_collision": true
			},
			"minecraft:pushable": {
				"is_pushable": true
			},
			"minecraft:collision_box": {
				"height": 2.9,
				"width": 1.5
			},
			"minecraft:push_through": {
				"value": 1
			},

			"minecraft:behavior.float": {
				"priority": 0
			},
			"minecraft:health": {
				"value": 30
			},
			"minecraft:navigation.walk": {},
			"minecraft:movement.basic": {},
			"minecraft:movement": {
				"value": 0.9
			},
			"minecraft:custom_hit_test": {
				"hitboxes": [
					{
						"width": 0.8,
						"height": 0.6,
						"pivot": [0, 1.4, 0]
					}
				]
			},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"on_damage": {
							"filters": {
								"test": "has_damage",
								"subject": "self",
								"value": "fatal"
							},
							"event": "sumonear_dos"
						},
						"deals_damage": false
					},
					{
						"on_damage": {
							"filters": {
								"all_of": [
									{
										"test": "is_family",
										"subject": "other",
										"value": "bola_veneno"
									}
								]
							}
						},
						"deals_damage": false
					}
				]
			},
			"minecraft:behavior.random_look_around": {
				"priority": 8
			},
			"minecraft:behavior.random_stroll": {
				"priority": 6,
				"speed_multiplier": 1
			},
			"minecraft:behavior.look_at_target": {
				"look_distance": 8,
				"probability": 0.02,
				"angle_of_view_vertical": 360,
				"angle_of_view_horizontal": 360
			},
			"minecraft:behavior.look_at_player": {
				"priority": 7,
				"look_distance": 8
			},
			"minecraft:behavior.hurt_by_target": {
				"priority": 1,
				"entity_types": {
					"filters": {
						"test": "is_family",
						"subject": "other",
						"operator": "!=",
						"value": "hydra_head"
					},
					"max_dist": 64
				}
			},
			"minecraft:shooter": {
				"def": "cc_fairytales:poison_ball"
			},
			"minecraft:behavior.ranged_attack": {
				"priority": 0,
				"burst_shots": 3,
				"burst_interval": 0.1,
				"attack_interval_min": 1.0,
				"attack_interval_max": 3.0,
				"attack_radius": 15.0
			},
			"minecraft:target_nearby_sensor": {
				"must_see": false,
				"inside_range": 30,
				"outside_range": 45
			},
			"minecraft:behavior.nearest_attackable_target": {
				"attack_owner": false,
				"must_reach": true,
				"must_see": true,
				"must_see_forget_duration": 3,
				"persist_time": 3,
				"reselect_targets": true,
				"scan_interval": 10,
				"set_persistent": true,
				"target_invisible_multiplier": 0.5,
				"target_search_height": -1,
				"target_sneak_visibility_multiplier": 0.8,
				"entity_types": [
					{
						"filters": {
							"test": "is_family",
							"subject": "other",
							"value": "player"
						},
						"max_dist": 16
					},
					{
						"filters": {
							"test": "is_family",
							"subject": "other",
							"value": "irongolem"
						},
						"max_dist": 16
					}
				]
			}
		},
		"events": {
			"minecraft:entity_spawned": {
				"add": {
					"component_groups": ["cabeza1", "sensor_fuera_cuerpo"]
				}
			},
			"marcado_2": {
				"remove": {
					"component_groups": ["cabeza1"]
				},
				"add": {
					"component_groups": ["cabeza2", "sensor_fuera_cuerpo"]
				}
			},
			"marcado_3": {
				"remove": {
					"component_groups": ["cabeza2"]
				},
				"add": {
					"component_groups": ["cabeza3", "sensor_fuera_cuerpo"]
				}
			},
			"marcado_4": {
				"remove": {
					"component_groups": ["cabeza3"]
				},
				"add": {
					"component_groups": ["cabeza4", "sensor_fuera_cuerpo"]
				}
			},
			"marcado_5": {
				"remove": {
					"component_groups": ["cabeza4"]
				},
				"add": {
					"component_groups": ["cabeza5", "sensor_fuera_cuerpo"]
				}
			},
			"sumonear_dos": {
				"add": {
					"component_groups": ["summon_dos"]
				}
			},
			"iniciar_timer": {
				"remove": {
					"component_groups": ["sensor_fuera_cuerpo"]
				},
				"add": {
					"component_groups": ["periodo_gracia"]
				}
			},
			"preparar_muerte": {
				"remove": {
					"component_groups": ["periodo_gracia"]
				},
				"add": {
					"component_groups": ["sensor_muerte"]
				}
			},
			"morir": {
				"add": {
					"component_groups": ["die"]
				}
			}
		}
	}
}
