{
	"format_version": "1.16.0",
	"minecraft:entity": {
		"description": {
			"identifier": "ldz:ender_scourge",
			"is_spawnable": true,
			"is_summonable": true,
			"is_experimental": false,
			"animations": {
				"ctrl.summon": "controller.animation.ender_scourge.summon",
				"clear_poison": "animation.ender_scourge.clear_poison",
				"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.summon",
					"clear_poison",
					"ctrl.ice_timer",
					{ "summon_end_force_power_4": "!q.is_alive" }
				]
			},
			"properties": {
				"ldz:ice_overlay": {
					"type": "bool",
					"client_sync": true,
					"default": false
				}
			}
		},
		"component_groups": {
			"ice_overlay": {				
				"minecraft:is_shaking": {}
			},
			"instant_despawn": {
				"minecraft:instant_despawn": {}
			}
		},
		"components": {
			"minecraft:type_family": {
				"family": [
					"ldz",
					"ender",
					"ender_scourge",
					"monster",
					"mob"
				]
			},
			"minecraft:is_shaking": {},
			"minecraft:collision_box": {
				"width": 0.6,
				"height": 2.9
			},
			"minecraft:nameable": {},
			"minecraft:loot": {
				"table": "loot_tables/entities/ender_scourge.json"
			},
			"minecraft:health": {
				"value": 40,
				"max": 40
			},
			"minecraft:hurt_on_condition": {
				"damage_conditions": [
					{
						"filters": {
							"test": "in_lava",
							"subject": "self",
							"operator": "==",
							"value": true
						},
						"cause": "lava",
						"damage_per_tick": 4
					}
				]
			},
			"minecraft:attack": {
				"damage": 3,
				"effect_name": "poison",
				"effect_duration": 4
			},
			"minecraft:navigation.walk": {
				"is_amphibious": true,
				"can_pass_doors": true,
				"can_break_doors": true,
				"avoid_portals": false
			},
			"minecraft:movement": {
				"value": 0.15
			},
			"minecraft:movement.basic": {},
			"minecraft:jump.static": {},
			"minecraft:can_climb": {},
			"minecraft:despawn": {
				"despawn_from_distance": {}
			},
			"minecraft:behavior.melee_attack": {
				"priority": 3
			},
			"minecraft:behavior.random_stroll": {
				"priority": 7,
				"speed_multiplier": 1
			},
			"minecraft:behavior.look_at_player": {
				"priority": 8,
				"look_distance": 16,
				"probability": 1
			},
			"minecraft:behavior.random_look_around": {
				"priority": 9
			},
			"minecraft:behavior.hurt_by_target": {
				"priority": 1
			},
			"minecraft:behavior.summon_entity": {
				"priority": 2,
				"summon_choices": [
					{
						"min_activation_range": 0,
						"max_activation_range": 8,
						"cooldown_time": 5,
						"weight": 1,
						"cast_duration": 1.25,
						"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_scourge_projectile<despawn>",
								"size": 0,
								"entity_lifespan": 0.1
							}
						]
					}
				]
			},
			"minecraft:behavior.nearest_attackable_target": {
				"priority": 2,
				"entity_types": [
					{
						"filters": {
							"any_of": [
								{
									"test": "is_family",
									"subject": "other",
									"value": "player"
								},
								{
									"test": "is_family",
									"subject": "other",
									"value": "snowgolem"
								},
								{
									"test": "is_family",
									"subject": "other",
									"value": "irongolem"
								},
								{
									"test": "is_family",
									"subject": "other",
									"value": "wandering_trader"
								}
							]
						},
						"max_dist": 20
					},
					{
						"filters": {
							"all_of": [
								{
									"test": "is_family",
									"subject": "other",
									"value": "villager"
								},
								{
									"test": "has_component",
									"subject": "other",
									"operator": "!=",
									"value": "minecraft:is_baby"
								}
							]
						},
						"max_dist": 20
					}
				],
				"must_see": true
			},
			"minecraft:environment_sensor": {
				"triggers": [
					{
						"filters": {
							"any_of": [
								{ "test": "is_difficulty", "value": "peaceful" },
								{ "test": "distance_to_nearest_player", "operator": ">=", "value": 70 }
							]
						},
						"event": "despawn"
					}
				]
			},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"on_damage": {
							"filters": {
								"any_of": [
									{
										"test": "has_damage",
										"value": "magic"
									} // poison
								]
							}
						},
						"deals_damage": false
					},
					{
						"on_damage": {
							"filters": {
								"test": "has_damage",
								"value": "void"
							},
							"event": "despawn"
						},
						"deals_damage": false
					},
					{
						"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:behavior.look_at_target": {
				"priority": 3,
				"look_distance": 16,
				"probability": 1
			}
		},
		"events": {
			"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"
					]
				}
			}
		}
	}
}