{
	"format_version": "1.18.0",
	"minecraft:entity": {
		"description": {
			"identifier": "ldz:levitation_tube",
			"is_spawnable": false,
			"is_summonable": true,
			"is_experimental": false,
			"properties": {				
				"ldz:near_player": {
					"client_sync": true,
					"type": "bool",
					"default": false
				}
			},
			"animations": {
				"ctrl.levitation_effects":"controller.animation.levitation_tube.levitation_effects"
			},
			"scripts": {
				"animate": [
					{"ctrl.levitation_effects":"q.property('ldz:near_player') == true"}
				]
			}
		},
		"component_groups": {
			"instant_despawn": {
				"minecraft:instant_despawn": {}
			}
		},
		"components": {
			"minecraft:type_family": {
				"family": [
					"ldz",
					"levitation_tube"
				]
			},
			"minecraft:collision_box": {
				"height": 0,
				"width": 0
			},
			"minecraft:custom_hit_test": {
				"hitboxes": [
					{
						"width": 5,
						"height": 52,
						"pivot": [
							0,
							1,
							0
						]
					}
				]
			},
			"minecraft:physics": {
				"has_collision": false,
				"has_gravity": false
			},
			"minecraft:environment_sensor": {
				"triggers": [
					{
						"event": "set_near_player_to_true",
						"target": "self",						
						"filters": [
							{
								"all_of":[
									{ "test": "bool_property", "domain": "ldz:near_player",	"value": false },
									{ "test": "distance_to_nearest_player", "operator":"<=" , "value": 64 }
								]
							}
						]
					},
					{
						"event": "set_near_player_to_false",
						"target": "self",						
						"filters": [
							{							
								"all_of": [								
									{ "test": "bool_property", "domain": "ldz:near_player", "value": true },
									{  "test": "distance_to_nearest_player",  "operator":">", "value": 64 }
								]
							}							
						]
					}
				]
			},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"on_damage": {
							"filters": {
								"test": "has_damage",
								"value": "void"
							},
							"event": "despawn"
						},
						"deals_damage": false
					},
					{
						"cause": "all",
						"deals_damage": false
					}
				]
			}
		},
		"events": {
			"despawn"					: {	"add": { "component_groups": [ "instant_despawn" ] } },
			"set_near_player_to_true" 	: { "set_property": { "ldz:near_player": true  } },
			"set_near_player_to_false"	: { "set_property": { "ldz:near_player": false } }
		}
	}
}