{
	"format_version": "1.18.0",
	"minecraft:entity": {
		"description": {
			"identifier": "ldz:end_force",
			"is_spawnable": false,
			"is_summonable": true,
			"is_experimental": false,
			"properties": {
				"ldz:power": {
					"type": "int",
					"range": [
						1,
						5
					],
					"default": 1,
					"client_sync": true
				},
				"ldz:nearest_player_distance": {
					"type": "int",
					"range": [
						1,
						5
					],
					"default": 1,
					"client_sync": true
				},
				"ldz:absorbing": {
					"type": "bool",
					"default": false,
					"client_sync": true
				},
				"ldz:wisp_spawned": {
					"type": "bool",
					"default": false,
					"client_sync": true
				},
				"ldz:ice_overlay": {
					"type": "bool",
					"client_sync": true,
					"default": false
				}
			},
			"animations": {
				"detect_player": "animation.end_force.detect_player",
				"lifetime_wisp": "animation.end_force.lifetime_wisp",
				"absorb_power_1": "animation.end_force.absorb_power_1",
				"absorb_power_2": "animation.end_force.absorb_power_2",
				"absorb_power_3": "animation.end_force.absorb_power_3",
				"absorb_power_4": "animation.end_force.absorb_power_4",
				"absorb_power_5": "animation.end_force.absorb_power_5",
				"ctrl.absorb": "controller.animation.end_force.absorb",
				"ctrl.absorbing_loop": "controller.animation.end_force.absorbing_loop"
			},
			"scripts": {
				"animate": [
					{ "lifetime_wisp": "q.property('ldz:wisp_spawned')" },
					"ctrl.absorb"
				]
			}
		},
		"component_groups": {
			"ice_overlay":{
				"minecraft:is_shaking": {}
			},
			
			"instant_despawn": {
				"minecraft:instant_despawn": {}
			}
		},
		"components": {
			"minecraft:spell_effects": {
				"add_effects": [
					{
						"effect": "slow_falling",
						"duration": 300,
						"visible": false
					}
				]
			},
			"minecraft:timer": {
				"time": 300,
				"looping": false,
				"time_down_event": {
					"event": "despawn"
				}
			},
			"minecraft:type_family": {
				"family": [
					"ldz",
					"end_force"
				]
			},
			"minecraft:collision_box": {
				"height": 0,
				"width": 0
			},
			"minecraft:physics": {
				"has_collision": true,
				"has_gravity": true
			},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"on_damage": {
							"filters": {
								"test": "has_damage",
								"value": "void"
							},
							"event": "despawn"
						},
						"deals_damage": false
					},
					{
						"cause": "all",
						"deals_damage": false
					}
				]
			},
			"minecraft:pushable": {
				"is_pushable": false,
				"is_pushable_by_piston": false
			}
		},
		"events": {
			"despawn": {
				"add": {
					"component_groups": [
						"instant_despawn"
					]
				}
			},
			// Properties
			"set_power_to_1": {
				"set_property": {
					"ldz:power": 1
				}
			},
			"set_power_to_2": {
				"set_property": {
					"ldz:power": 2
				}
			},
			"set_power_to_3": {
				"set_property": {
					"ldz:power": 3
				}
			},
			"set_power_to_4": {
				"set_property": {
					"ldz:power": 4
				}
			},
			"set_power_to_5": {
				"set_property": {
					"ldz:power": 5
				}
			},
			"set_nearest_player_distance_to_1": {
				"set_property": {
					"ldz:nearest_player_distance": 1
				}
			},
			"set_nearest_player_distance_to_2": {
				"set_property": {
					"ldz:nearest_player_distance": 2
				}
			},
			"set_nearest_player_distance_to_3": {
				"set_property": {
					"ldz:nearest_player_distance": 3
				}
			},
			"set_nearest_player_distance_to_4": {
				"set_property": {
					"ldz:nearest_player_distance": 4
				}
			},
			"set_nearest_player_distance_to_5": {
				"set_property": {
					"ldz:nearest_player_distance": 5
				}
			},
			"set_absorbing_to_false": {
				"set_property": {
					"ldz:absorbing": false
				}
			},
			"set_absorbing_to_true": {
				"set_property": {
					"ldz:absorbing": true
				}
			},
			"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"
					]
				}
			},
			"wisp_spawned": {
				"set_property": {
					"ldz:ice_overlay": true,
					"ldz:power": 3
				}
			}
		}
	}
}