//bridge-file-version: #298
{
	"format_version": "1.14.0",
	"minecraft:entity": {
		"description": {
			"identifier": "car:caravan",
			"is_spawnable": true,
			"is_summonable": true,
			"is_experimental": false
		},
		"components": {  

			"minecraft:healable": {
			"items": [
			  {
				"item": "iron_ingot",
				"heal_amount": 10
			  },
			  {
				"item": "diamond",
				"heal_amount": 49
			  }
			]
		  },
			"minecraft:breathable": {
				"totalSupply": 15,
				"suffocateTime": 0
			},
			"minecraft:knockback_resistance": {
                "value": 99,
                "max": 99
            },
			"minecraft:inventory": {
			"inventory_size": 16,
			"container_type": "container", 
			"private": false
			},
			"minecraft:collision_box": {
				"width": 2,
				"height": 2
			},
			"minecraft:navigation.walk": {
				"can_path_over_water": true
			},
			"minecraft:movement.basic": {},
			"minecraft:jump.static": {},
			"minecraft:health": {
				"value": 50,
				"max": 50
			},
			"minecraft:scale": {
				"value": 1
			},
			"minecraft:interact": {
				"interactions": [
					{
						"interact_text": "Lock/Unlock",
						"on_interact": {
							"filters": {
								"test": "is_riding",
								"subject": "other",
								"value": true
							},
							"event": "fly"
						}
					}
				]
			},
			"minecraft:nameable": {},
			"minecraft:rideable": {
				"priority": 0,
				"seat_count": 2,
				"rotate_rider_by": -90,
				"lock_rider_rotation": 90,
				"crouching_skip_interact": true,
				"family_types": [
            "player",
            "zombie"],
				"interact_text": "Ride",
				"seats": [		
					{
						"position": [
							-0.9,
							1.05,
							-0.8
						]
					},
					{
						"position": [
							-0.9,
							1.05,
							0.4
						]
					}				
				],
				"rider_can_interact": true
			},
			"minecraft:type_family": {
				"family": [
					"car", "caravan"
				]
			},
			"minecraft:pushable": {
				"is_pushable": false,
				"is_pushable_by_piston": false
			},
			"minecraft:physics": {},
			"minecraft:input_ground_controlled": {},
			"minecraft:damage_sensor": {
				"triggers": [
					{
						"cause": "fall",
						"deals_damage": true
					}
				]
			},
			"minecraft:movement": {
				"value": 0
			},
			"minecraft:variant": {
				"value": 0
			},
			"minecraft:loot": {
				"table": "loot_tables/caravan.json"
			}
		},
		"component_groups": {
			"fly_start": {
			"minecraft:variant": {
					"value": 1
				},
				"minecraft:movement": {
				"value": 1.425
			},
				"minecraft:environment_sensor": {
				"triggers": {
				  "filters": {
					"test": "is_underwater",
					"subject": "self",
					"operator": "==",
					"value": true
				  }
				}
				},
				"minecraft:behavior.ranged_attack": {
				"attack_interval_min": 1,
				"attack_interval_max": 3,
				"attack_radius": 10
				  },
				  "minecraft:behavior.hurt_by_target": {
					"priority": 1
				  },
				  "minecraft:behavior.nearest_attackable_target": {
					"priority": 2,
					"reselect_targets": true,
					"entity_types": [
					  {
						"filters": {
						  "test": "is_family",
						  "subject": "other",
						  "value": "suv"
						},
						"max_dist": 15
					  }
					],
					"must_see": true
				  },
				"minecraft:spell_effects": {
				"add_effects": [
				{
				"effect": "fire_resistance",
				"duration": 126000,
				"visible": false,
				"amplifier": 5,
				"ambient": 5
				}
				],
				"remove_effects": [
				]
				}
			},
			"fly_stop": {
			"minecraft:spell_effects": {
				"add_effects": [
				],
				"remove_effects": [ "fire_resistance" ]
				},
				"minecraft:movement": {
				"value": 0
				},
								"minecraft:variant": {
					"value": 0
				},
				"minecraft:movement": {
				"value": 0
			},
						"minecraft:environment_sensor": {
        "triggers": {
          "filters": {
            "test": "is_underwater",
            "subject": "self",
            "operator": "==",
            "value": true
          }
        }
		},
		"minecraft:behavior.ranged_attack": {
        "attack_interval_min": 1,
        "attack_interval_max": 3,
        "attack_radius": 0
		  },
		  "minecraft:behavior.hurt_by_target": {
			"priority": 1
		  },
		  "minecraft:behavior.nearest_attackable_target": {
			"priority": 2,
			"reselect_targets": true,
			"entity_types": [
			  {
				"filters": {
				  "test": "is_family",
				  "subject": "other",
				  "value": "suv"
				},
				"max_dist": 0
			  }
			],
			"must_see": true
		  }
			}
		},
		"events": {
			"fly": {
				"sequence": [
					{
						"filters": {
							"test": "is_variant",
							"subject": "self",
							"value": 0
						},
						"add": {
							"component_groups": [
								"fly_start"
							]
						},
						"remove": {
							"component_groups": [
								"fly_stop"
							]
						}
					},
					{
						"filters": {
							"test": "is_variant",
							"subject": "self",
							"value": 1
						},
						"add": {
							"component_groups": [
								"fly_stop"
							]
						},
						"remove": {
							"component_groups": [
								"fly_start"
							]
						}
					}
					]
				}
		}
	}
}