{
	"format_version": "1.19.50",
	"minecraft:entity": {
		"description": {
			"identifier": "ldz:ender_mystic",
			"is_spawnable": true,
			"is_summonable": true,
			"is_experimental": false,
			"properties": {
				"ldz:beam_state": {
					"type": "int",
					"range": [
						0,
						3
					],
					"default": 0,
					"client_sync": true
				},
				"ldz:has_damage": {
					"type": "bool",
					"default": false,
					"client_sync": true
				},
				"ldz:ice_overlay": {
					"type": "bool",
					"client_sync": true,
					"default": false
				}
			},
			"animations": {
				"slow_fall": "animation.ender_mystic.slow_fall",
				"charge_delay": "animation.ender_mystic.charge_delay",
				"beam_delay": "animation.ender_mystic.beam_delay",
				"end_delay": "animation.ender_mystic.end_delay",
				"ctrl.damage": "controller.animation.ender_mystic.damage",
				"ctrl.charge": "controller.animation.ender_mystic.charge",
				"ctrl.look_at_player": "controller.animation.ender_mystic.look_at_player",
				"look_at_player": "animation.ender_mystic.look_at_player",
				"stop_aiming": "animation.ender_mystic.stop_aiming",
				"summon_end_force_power_4": "animation.generic.summon_end_force_power_4",
				"ctrl.ice_timer": "controller.animation.vanilla.ice_timer",
				"ice_timer": "animation.vanilla.ice_timer",
				"ice_damage": "animation.vanilla.ice_damage"			
			},
			"scripts": {
				"animate": [
					"ctrl.damage",
					"ctrl.charge",
					"slow_fall",
					"ctrl.look_at_player",
					"ctrl.ice_timer",
					{
						"summon_end_force_power_4": "!q.is_alive"
					}
				]
			}
		},
		"component_groups": {
			"ice_overlay": {				
				"minecraft:is_shaking": {}
			},
			"forced_panic": {
				"minecraft:behavior.panic": {
					"force": true,
					"ignore_mob_damage": true,
					"prefer_water": false,
					"priority": 0,
					"speed_multiplier": 1.1
				},
				"minecraft:timer": {
					"time": [ 1, 3 ],
					"looping": true,
					"time_down_event": {
						"event": "remove_panic"
					}
				}
			},
			"attack_mode": {
				"minecraft:behavior.summon_entity": {
					"priority": 2,
					"summon_choices": [
						{
							"min_activation_range": 0,
							"max_activation_range": 13,
							"cooldown_time": 5,
							"weight": 1,
							"cast_duration": 0.1,
							"particle_color": "#84ff00ba",
							"start_sound_event": "cast.spell",
							"sequence": [
								{
									"shape": "line",
									"target": "self",
									"base_delay": 1,
									"delay_per_summon": 0,
									"num_entities_spawned": 1,
									"entity_type": "ldz:ender_mystic_projectile<despawn>",
									"size": 0,
									"entity_lifespan": 0.1
								}
							]
						}
					]
				}
			},
			"stroll": {
				"minecraft:behavior.random_stroll": {
					"priority": 7,
					"speed_multiplier": 1,
					"interval": 45
				}
			},
			"instant_despawn": {
				"minecraft:instant_despawn": {}
			}
		},
		"components": {
			"minecraft:environment_sensor": {
				"triggers": [
					{
						"filters": [
							{
								"test": "distance_to_nearest_player",
								"operator": "<=",
								"value": 16
							},
							{
								"test": "has_component",
								"operator": "==",
								"value": "minecraft:behavior.random_stroll"
							}
						],
						"event": "remove_stroll",
						"target": "self"
					},
					{
						"filters": [
							{
								"test": "distance_to_nearest_player",
								"operator": ">",
								"value": 16
							},
							{
								"test": "has_component",
								"operator": "!=",
								"value": "minecraft:behavior.random_stroll"
							}
						],
						"event": "add_stroll",
						"target": "self"
					},
					{
						"filters": [
							{
								"test": "has_target",
								"value": false
							},
							{
								"test": "int_property",
								"domain": "ldz:beam_state",
								"operator": ">",
								"value": 0
							}
						],
						"event": "set_beam_state_to_0",
						"target": "self"
					},
					{
						"filters": {
							"any_of": [
								{ "test": "is_difficulty", "value": "peaceful" },
								{ "test": "distance_to_nearest_player", "operator": ">=", "value": 70 }
							]
						},
						"event": "despawn"
					}
				]
			},
			"minecraft:type_family": {
				"family": [
					"ldz",
					"ender",
					"ender_mystic",
					"monster",
					"mob",
					"flight_mob"
				]
			},
			"minecraft:health": {
				"value": 40,
				"max": 40
			},
			"minecraft:collision_box": {
				"width": 0.7,
				"height": 2.4
			},
			"minecraft:loot": {
				"table": "loot_tables/entities/ender_mystic.json"
			},
			"minecraft:navigation.walk": {
				"is_amphibious": true,
				"can_pass_doors": true,
				"can_break_doors": true,
				"avoid_portals": false
			},
			"minecraft:movement": {
				"value": 0.3
			},
			"minecraft:movement.basic": {},
			"minecraft:jump.static": {},
			"minecraft:can_climb": {},
			"minecraft:behavior.hurt_by_target": {
				"priority": 1
			},
			"minecraft:nameable": {},
			"minecraft:behavior.float": {
				"priority": 0
			},
			"minecraft:behavior.nearest_attackable_target": {
				"priority": 2,
				"entity_types": [
					{
						"filters": {
							"any_of": [
								{
									"test": "is_family",
									"subject": "other",
									"value": "player"
								}
							]
						},
						"max_dist": 16
					}
				],
				"must_see": true
			},
			"minecraft:follow_range": {
				"value": 64
			},
			"minecraft:behavior.look_at_player": {
				"priority": 8,
				"look_distance": 16,
				"probability": 1
			},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"on_damage": {
							"filters": {
								"test": "has_damage",
								"value": "void"
							},
							"event": "despawn"
						},
						"deals_damage": false
					},
					{
						"cause": "fall",
						"deals_damage": false
					},
					{
						"cause": "all",
						"on_damage": {
							"event": "set_has_damage_to_true"
						},
						"deals_damage": true
					},
					{
						"on_damage": {
							"filters": {
								"any_of":[
									{ "test": "has_equipment", "subject": "other", "domain": "hand", "value": "minecraft:iron_axe" },
									{ "test": "has_equipment", "subject": "other", "domain": "hand", "value": "minecraft:iron_sword" },
									{ "test": "has_equipment", "subject": "other", "domain": "hand", "value": "minecraft:gold_sword" },
									{ "test": "has_equipment", "subject": "other", "domain": "hand", "value": "minecraft:diamond_sword" },
									{ "test": "has_equipment", "subject": "other", "domain": "hand", "value": "minecraft:netherite_sword" }
								]
							}
						},
						"damage_multiplier": 0.75
					},
					{
						"on_damage": {
							"filters": {
								"test": "is_family",
								"subject": "other",
								"value": "player_lord_wisp"
							},
							"target": "other",
							"event": "add_1_to_hits"
						}
					}
				]
			},
			"minecraft:physics": {},
			"minecraft:pushable": {
				"is_pushable": true,
				"is_pushable_by_piston": true
			},
			"minecraft:despawn": {}
		},
		"events": {
			"add_panic": {
				"remove": {
					"component_groups": [
						"attack_mode"
					]
				},
				"add": {
					"component_groups": [
						"forced_panic"
					]
				}
			},
			"remove_panic": {
				"remove": {
					"component_groups": [
						"forced_panic"
					]
				},
				"add": {
					"component_groups": [
						"attack_mode"
					]
				}
			},
			"add_attack_mode": {
				"add": {
					"component_groups": [
						"attack_mode"
					]
				}
			},
			"remove_attack_mode": {
				"remove": {
					"component_groups": [
						"attack_mode"
					]
				}
			},
			"add_stroll": {
				"add": {
					"component_groups": [
						"stroll"
					]
				}
			},
			"remove_stroll": {
				"remove": {
					"component_groups": [
						"stroll"
					]
				}
			},
			"set_has_damage_to_false": {
				"set_property": {
					"ldz:has_damage": false
				}
			},
			"set_has_damage_to_true": {
				"set_property": {
					"ldz:has_damage": true
				}
			},
			"set_beam_state_to_0": {
				"set_property": {
					"ldz:beam_state": 0
				}
			},
			"set_beam_state_to_1": {
				"set_property": {
					"ldz:beam_state": 1
				}
			},
			"set_beam_state_to_2": {
				"set_property": {
					"ldz:beam_state": 2
				}
			},
			"set_beam_state_to_3": {
				"set_property": {
					"ldz:beam_state": 3
				}
			},
			"minecraft:entity_spawned": {
				"add": {
					"component_groups": [
						"attack_mode"
					]
				}
			},
			"despawn": {
				"add": {
					"component_groups": [
						"instant_despawn"
					]
				}
			},
			"set_ice_overlay_to_true": {
				"set_property": {
					"ldz:ice_overlay": true
				},
				"add": {
					"component_groups": [
						"ice_overlay"
					]
				}
			},
			"set_ice_overlay_to_false": {
				"set_property": {
					"ldz:ice_overlay": false
				},
				"remove": {
					"component_groups": [
						"ice_overlay"
					]
				}
			}
		}
	}
}