{
	"format_version": "1.16.0",
	"minecraft:entity": {
		"description": {
			"identifier": "cc_fairytales:alicorn",
			"is_spawnable": true,
			"is_summonable": true,
			"is_experimental": false,
			"animations": {
				"fly": "controller.animation.cc_fairytales.flying"
			},
			"scripts": {
				"animate": ["fly"]
			}
		},
		"component_groups": {
			// comportamiento para vuelo
			"up": {
				"minecraft:mark_variant": {
					"value": 0
				},
				"minecraft:spell_effects": {
					"add_effects": [
						{
							"effect": "levitation",
							"duration": 100,
							"amplifier": 3,
							"visible": false
						}
					],
					"remove_effects": "slow_falling"
				},
				"minecraft:movement": {
					"value": 1.0
				}
			},
			"reset": {
				"minecraft:mark_variant": {
					"value": 1
				},
				"minecraft:spell_effects": {
					"remove_effects": ["levitation", "slow_falling"]
				},
				"minecraft:movement": {
					"value": 0.5
				}
			},
			"down": {
				"minecraft:mark_variant": {
					"value": 2
				},
				"minecraft:spell_effects": {
					"add_effects": [
						{
							"effect": "slow_falling",
							"duration": 100,
							"amplifier": 1,
							"visible": false
						}
					],
					"remove_effects": "levitation"
				},
				"minecraft:movement": {
					"value": 1.0
				}
			},
			"stable": {
				"minecraft:mark_variant": {
					"value": 3
				},
				"minecraft:spell_effects": {
					"add_effects": [
						{
							"effect": "levitation",
							"duration": 100,
							"amplifier": -1,
							"visible": false
						}
					] //,
					//"remove_effects": "levitation" //puesto para sobreescribir el slow falling positivo y hacerlo más exacto en caso de necesitarlo
				}
			},

			// comportamiento del pegaso en tierra
			"pegacornio_baby": {
				"minecraft:is_baby": {},
				"minecraft:scale_by_age": {
					"start_scale": 0.5,
					"end_scale": 1
				},
				"minecraft:ageable": {
					"duration": 1200,
					"feed_items": [
						{
							"item": "golden_apple",
							"growth": 0.2
						},
						{
							"item": "appleEnchanted",
							"growth": 0.2
						}
					],
					"grow_up": {
						"event": "minecraft:ageable_grow_up",
						"target": "self"
					}
				},
				"minecraft:behavior.follow_parent": {
					"priority": 4,
					"speed_multiplier": 1
				}
			},
			"pegacornio_adulto": {
				"minecraft:experience_reward": {
					"on_bred": "Math.Random(1,7)",
					"on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
				},
				"minecraft:loot": {
					"table": "loot_tables/chillcraft/fairy/entities/alicorn.json"
				}
			},
			"pegacornio_salvaje": {
				"minecraft:rideable": {
					"seat_count": 1,
					"family_types": ["player"],
					"interact_text": "action.interact.mount",
					"seats": {
						"position": [0, 1.1, -0.2]
					}
				},
				"minecraft:behavior.mount_pathing": {
					"priority": 2,
					"speed_multiplier": 1.5,
					"target_dist": 0,
					"track_target": true
				},
				"minecraft:tamemount": {
					"min_temper": 0,
					"max_temper": 300,
					"feed_text": "action.interact.feed",
					"ride_text": "action.interact.mount",
					"feed_items": [
						{
							"item": "golden_apple",
							"temper_mod": 5
						},
						{
							"item": "appleEnchanted",
							"temper_mod": 5
						}
					],
					"auto_reject_items": [
						{
							"item": "horsearmorleather"
						},
						{
							"item": "horsearmoriron"
						},
						{
							"item": "horsearmorgold"
						},
						{
							"item": "horsearmordiamond"
						},
						{
							"item": "saddle"
						}
					],
					"tame_event": {
						"event": "tamear_pegacornio",
						"target": "self"
					}
				}
			},
			"caballo_tameado": {
				"minecraft:is_tamed": {},
				"minecraft:rideable": {
					"seat_count": 1,
					"crouching_skip_interact": true,
					"family_types": ["player"],
					"interact_text": "cc.ft.action.interact.ride.pegasus",
					"seats": {
						"position": [0, 1.1, -0.2]
					}
				},
				"minecraft:inventory": {
					"inventory_size": 16,
					"container_type": "horse",
					"restrict_to_owner": true
				},
				"minecraft:is_chested": {
				},
				"minecraft:behavior.breed": {
					"priority": 2
				},
				"minecraft:breedable": {
					"require_tame": true,
					"inherit_tamed": false,
					"breeds_with": [
						{
							"mate_type": "cc_fairytales:pegasus",
							"baby_type": "cc_fairytales:unicorn",
							"breed_event": {
								"event": "minecraft:entity_born",
								"target": "baby"
							}
						}
					],
					"breed_items": [
						"golden_apple",
						"appleEnchanted"
					]
				}
			},
			"caballo_con_montura": {
				"minecraft:is_saddled": {},
				"minecraft:input_ground_controlled": {},
				"minecraft:can_power_jump": {},
				"minecraft:behavior.player_ride_tamed": {}
			},
			"pegacornio_blanco": {
				"minecraft:variant": {
					"value": 0
				}
			},
			"pegacornio_negro": {
				"minecraft:variant": {
					"value": 1
				}
			}
		},
		"components": {
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"cause": "fall",
						"deals_damage": false
					}
				]
			},
			"minecraft:equippable": {
				"slots": [
					{
						"slot": 0,
						"item": "saddle",
						"accepted_items": ["saddle"],
						"on_equip": {
							"event": "poner_montura"
						},
						"on_unequip": {
							"event": "quitar_montura"
						}
					}
					/*,
					{
						"slot": 1,
						"item": "horsearmoriron",
						"accepted_items": [
							"horsearmorleather",
							"horsearmoriron",
							"horsearmorgold",
							"horsearmordiamond"
						]
					}*/
				]
			},
			"minecraft:type_family": {
				"family": ["pegasus", "mob"]
			},
			"minecraft:breathable": {
				"total_supply": 25,
				"suffocate_time": 0
			},
			"minecraft:collision_box": {
				"width": 1.4,
				"height": 1.6
			},
			"minecraft:health": {
				"value": {
					"range_min": 40,
					"range_max": 90
				}
			},
			"minecraft:hurt_on_condition": {
				"damage_conditions": [
					{
						"filters": {
							"test": "in_lava",
							"subject": "self",
							"operator": "==",
							"value": true
						},
						"cause": "lava",
						"damage_per_tick": 1
					}
				]
			},
			"minecraft:movement": {
				"value": 0.5
			},
			"minecraft:navigation.walk": {
				"can_path_over_water": true,
				"avoid_water": true,
				"avoid_damage_blocks": true
			},
			"minecraft:movement.basic": {},
			"minecraft:jump.static": {},
			"minecraft:nameable": {},
			"minecraft:horse.jump_strength": {
				"value": 3
			},
			"minecraft:leashable": {
				"soft_distance": 4,
				"hard_distance": 6,
				"max_distance": 10
			},
			"minecraft:healable": {
				"items": [
					{
						"item": "wheat",
						"heal_amount": 2
					},
					{
						"item": "sugar",
						"heal_amount": 1
					},
					{
						"item": "hay_block",
						"heal_amount": 20
					},
					{
						"item": "apple",
						"heal_amount": 3
					},
					{
						"item": "golden_carrot",
						"heal_amount": 4
					},
					{
						"item": "golden_apple",
						"heal_amount": 10
					},
					{
						"item": "appleEnchanted",
						"heal_amount": 20
					}
				]
			},
			"minecraft:despawn": {
				"despawn_from_distance": {}
			},
			"minecraft:behavior.float": {
				"priority": 0
			},
			"minecraft:behavior.random_stroll": {
				"priority": 6,
				"speed_multiplier": 0.7
			},
			"minecraft:behavior.look_at_player": {
				"priority": 7,
				"look_distance": 6,
				"probability": 0.02
			},
			"minecraft:behavior.random_look_around": {
				"priority": 8
			},
			"minecraft:physics": {},
			"minecraft:pushable": {
				"is_pushable": true,
				"is_pushable_by_piston": true
			},
			"minecraft:conditional_bandwidth_optimization": {}
		},
		"events": {
			"minecraft:entity_spawned": {
				"sequence": [
					{
						"add": {
							"component_groups": [
								"pegacornio_adulto",
								"pegacornio_salvaje"
							]
						}
					},
					{
						"randomize": [
							{
								"add": {
									"component_groups": ["pegacornio_blanco"]
								},
								"weight": 10
							},
							{
								"add": {
									"component_groups": ["pegacornio_negro"]
								},
								"weight": 1
							}
						]
					},
					{
						"randomize": [
							{
								"add": {
									"component_groups": ["pegacornio_baby"]
								},
								"weight": 10
							},
							{
								"add": {
									"component_groups": ["pegacornio_adulto"]
								},
								"weight": 39
							}
						]
					}
				]
			},
			"minecraft:entity_born": {
				"sequence": [
					{
						"add": {
							"component_groups": ["pegacornio_baby"]
						}

					},
					{
						"randomize": [
							{
								"add": {
									"component_groups": ["pegacornio_blanco"]
								},
								"weight": 10
							},
							{
								"add": {
									"component_groups": ["pegacornio_negro"]
								},
								"weight": 10
							}
						]
					}
				]
			},
			"minecraft:ageable_grow_up": {
				"remove": {
				  "component_groups": [
					"pegacornio_baby"
				  ]
				},
				"add": {
				  "component_groups": [
					"pegacornio_adulto",
					"pegacornio_salvaje"
				  ]
				}
			  },
			"tamear_pegacornio": {
				"remove": {
					"component_groups": ["pegacornio_salvaje"]
				},
				"add": {
					"component_groups": ["caballo_tameado"]
				}
			},
			"poner_montura": {
				"add": {
					"component_groups": ["caballo_con_montura"]
				}
			},
			"quitar_montura": {
				"remove": {
					"component_groups": ["caballo_con_montura"]
				}
			},
			// eventos para controlar el vuelo
			"go:up": {
				"sequence": [
					{
						"filters": { "test": "is_mark_variant", "value": 2 },
						"remove": {
							"component_groups": ["down"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 1 },
						"remove": {
							"component_groups": ["reset"]
						}
					},
					{
						"add": {
							"component_groups": ["up"]
						}
					}
				]
			},
			"go:stable": {
				"sequence": [
					{
						"filters": { "test": "is_mark_variant", "value": 0 },
						"remove": {
							"component_groups": ["up"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 1 },
						"remove": {
							"component_groups": ["reset"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 2 },
						"remove": {
							"component_groups": ["down"]
						}
					},
					{
						"add": {
							"component_groups": ["stable"]
						}
					}
				]
			},
			"go:down": {
				"sequence": [
					{
						"filters": { "test": "is_mark_variant", "value": 0 },
						"remove": {
							"component_groups": ["up"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 1 },
						"remove": {
							"component_groups": ["reset"]
						}
					},
					{
						"add": {
							"component_groups": ["down"]
						}
					}
				]
			},
			"go:reset": {
				"sequence": [
					{
						"filters": { "test": "is_mark_variant", "value": 0 },
						"remove": {
							"component_groups": ["up"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 2 },
						"remove": {
							"component_groups": ["down"]
						}
					},
					{
						"filters": { "test": "is_mark_variant", "value": 3 },
						"remove": {
							"component_groups": ["stable"]
						}
					},
					{
						"add": {
							"component_groups": ["reset"]
						}
					}
				]
			}
		}
	}
}