{
  "format_version": "1.26.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:zombie_nautilus",
      "is_summonable": true,
      "is_spawnable": true,
      "properties": {
        "minecraft:variant": {
          "client_sync": true,
          "default": "default",
          "type": "enum",
          "values": [
            "default",
            "coral"
          ]
        }
      },
      "spawn_category": "monster"
    },
    "components": {
      "minecraft:attack": {
        "damage": 3
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:behavior.random_swim": {
        "interval": 0,
        "xz_dist": 16,
        "priority": 4,
        "speed_multiplier": 1.5,
        "y_dist": 4
      },
      "minecraft:behavior.swim_idle": {
        "priority": 6
      },
      "minecraft:behavior.swim_wander": {
        "interval": 10,
        "look_ahead": 2,
        "speed_multiplier": 1.5,
        "priority": 5
      },
      "minecraft:breathable": {
        "breathes_air": true,
        "breathes_water": true,
        "suffocate_time": 0,
        "total_supply": 15
      },
      "minecraft:burns_in_daylight": {
        "protection_slot": "slot.armor.body"
      },
      "minecraft:collision_box": {
        "height": 0.95,
        "width": 0.875
      },
      "minecraft:despawn": {
        "despawn_from_distance": {
          "max_distance": 40,
          "min_distance": 32
        }
      },
      "minecraft:experience_reward": {
        "on_death": {
          "expression": "query.last_hit_by_player ? Math.Random(1,3) : 0",
          "version": 13
        }
      },
      "minecraft:health": {
        "max": 15,
        "value": 15
      },
      "minecraft:home": {}, // This component needs to exist to allow 'set_home_position' in events
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "cause": "lava",
            "damage_per_tick": 4,
            "filters": {
              "test": "in_lava"
            }
          }
        ]
      },
      "minecraft:is_hidden_when_invisible": {},
      "minecraft:knockback_resistance": {
        "value": 0.3
      },
      "minecraft:leashable_to": {},
      "minecraft:loot": {
        "table": "loot_tables/entities/zombie_nautilus.json"
      },
      "minecraft:mob_effect_immunity": {
        "mob_effects": [
          "poison"
        ]
      },
      "minecraft:movement.sway": {
        "sway_amplitude": 0
      },
      "minecraft:nameable": {},
      "minecraft:navigation.generic": {
        "can_breach": false,
        "can_walk": false,
        "can_path_over_water": false,
        "can_sink": false,
        "can_swim": true,
        "is_amphibious": false
      },
      "minecraft:physics": {},
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      },
      "minecraft:type_family": {
        "family": [
          "aquatic",
          "zombie_nautilus",
          "undead",
          "monster",
          "mob"
        ]
      }
    },
    "component_groups": {
      "minecraft:zombie_nautilus_ai_controlled": {
        "minecraft:movement": {
          "value": 0.15
        },
        "minecraft:underwater_movement": {
          "value": 0.1
        }
      },
      "minecraft:zombie_nautilus_tame_saddled": {
        "minecraft:behavior.player_ride_tamed": {
          "priority": 0
        },
        "minecraft:home": {
          "restriction_radius": 16,
          "restriction_type": "random_movement"
        },
        "minecraft:is_saddled": {}
      },
      "minecraft:zombie_nautilus_leashable": {
        "minecraft:leashable": {
          "on_unleash": {
            "event": "minecraft:on_unleashed",
            "target": "self"
          },
          "presets": [
            {
              "hard_distance": 10,
              "max_distance": 14
            }
          ]
        }
      },
      "minecraft:zombie_nautilus_player_controlled": {
        "minecraft:movement": { //Hack to allow same speed as ai-controlled
          "value": 0.015
        },
        "minecraft:underwater_movement": {
          "value": 0.055
        }
      },
      "minecraft:zombie_nautilus_tame_saddled_in_water": {
        "minecraft:dash_action": {
          "can_dash_underwater": true,
          "vertical_momentum": 0.1,
          "cooldown_time": 2,
          "horizontal_momentum": 154,
          "direction": "passenger"
        },
        "minecraft:environment_sensor": {
          "triggers": [
            {
              "event": "minecraft:on_saddled_out_of_water",
              "filters": {
                "test": "in_water",
                "value": false
              }
            }
          ]
        },
        "minecraft:free_camera_controlled": {
          "backwards_movement_modifier": 0.5,
          "strafe_speed_modifier": 0.7
        },
        "minecraft:mob_effect": {
          "ambient": true,
          "mob_effect": "breath_of_the_nautilus",
          "effect_range": 1.6,
          "effect_time": 2,
          "entity_filter": {
            "all_of": [
              {
                "subject": "other",
                "test": "is_family",
                "value": "player"
              },
              {
                "subject": "other",
                "test": "is_riding_self"
              }
            ]
          }
        },
        "minecraft:underwater_mount_breathing": {}
      },
      "minecraft:zombie_nautilus_tame": {
        "minecraft:behavior.tempt": {
          "items": [
            "pufferfish_bucket",
            "cod_bucket",
            "salmon_bucket",
            "tropical_fish_bucket",
            "pufferfish",
            "fish",
            "salmon",
            "clownfish",
            "cooked_fish",
            "cooked_salmon"
          ],
          "on_tempt_end": {
            "event": "minecraft:on_stop_tempting"
          },
          "priority": 2,
          "speed_multiplier": 1.3
        },
        "minecraft:equippable": {
          "slots": [
            {
              "accepted_items": [
                "saddle"
              ],
              "item": "saddle",
              "on_equip": {
                "event": "minecraft:on_saddled"
              },
              "on_unequip": {
                "event": "minecraft:on_unsaddled"
              },
              "slot": 0
            },
            {
              "accepted_items": [
                "minecraft:copper_nautilus_armor",
                "minecraft:iron_nautilus_armor",
                "minecraft:golden_nautilus_armor",
                "minecraft:diamond_nautilus_armor",
                "minecraft:netherite_nautilus_armor"
              ],
              "item": "nautilusarmor",
              "on_equip": {
                "event": "minecraft:on_armor_equip"
              },
              "slot": 1
            }
          ]
        },
        "minecraft:healable": {
          "items": [
            {
              "heal_amount": 2,
              "item": "pufferfish_bucket",
              "result_item": "water_bucket:0"
            },
            {
              "heal_amount": 4,
              "item": "cod_bucket",
              "result_item": "water_bucket:0"
            },
            {
              "heal_amount": 4,
              "item": "salmon_bucket",
              "result_item": "water_bucket:0"
            },
            {
              "heal_amount": 2,
              "item": "tropical_fish_bucket",
              "result_item": "water_bucket:0"
            },
            {
              "heal_amount": 4,
              "item": "fish"
            },
            {
              "heal_amount": 4,
              "item": "salmon"
            },
            {
              "heal_amount": 2,
              "item": "clownfish"
            },
            {
              "heal_amount": 2,
              "item": "pufferfish"
            },
            {
              "heal_amount": 10,
              "item": "cooked_fish"
            },
            {
              "heal_amount": 12,
              "item": "cooked_salmon"
            }
          ]
        },
        "minecraft:interact": {
          "interactions": [
            {
              "equip_item_slot": "0",
              "interact_text": "action.interact.saddle",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "domain": "inventory",
                      "operator": "not",
                      "test": "has_equipment",
                      "subject": "self",
                      "value": "saddle"
                    },
                    {
                      "domain": "hand",
                      "subject": "other",
                      "test": "has_equipment",
                      "value": "saddle"
                    },
                    {
                      "subject": "other",
                      "test": "is_sneak_held",
                      "value": false
                    }
                  ]
                },
                "target": "self"
              }
            },
            {
              "drop_item_slot": "0",
              "hurt_item": 1,
              "interact_text": "action.interact.removesaddle",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "operator": "equals",
                      "test": "rider_count",
                      "subject": "self",
                      "value": 0
                    },
                    {
                      "domain": "inventory",
                      "subject": "self",
                      "test": "has_equipment",
                      "value": "saddle"
                    },
                    {
                      "domain": "hand",
                      "subject": "other",
                      "test": "has_equipment",
                      "value": "shears"
                    },
                    {
                      "subject": "other",
                      "test": "is_sneak_held",
                      "value": false
                    }
                  ]
                },
                "target": "self"
              },
              "play_sounds": "unsaddle",
              "vibration": "shear"
            },
            {
              "equip_item_slot": "1",
              "interact_text": "action.interact.equipnautilusarmor",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "domain": "inventory",
                      "operator": "not",
                      "test": "has_equipment_tag",
                      "subject": "self",
                      "value": "minecraft:nautilus_armor"
                    },
                    {
                      "domain": "hand",
                      "subject": "player",
                      "test": "has_equipment_tag",
                      "value": "minecraft:nautilus_armor"
                    },
                    {
                      "subject": "other",
                      "test": "is_sneak_held",
                      "value": false
                    }
                  ]
                },
                "target": "self"
              }
            },
            {
              "drop_item_slot": "1",
              "drop_item_y_offset": 1.1,
              "hurt_item": 1,
              "interact_text": "action.interact.removenautilusarmor",
              "on_interact": {
                "filters": {
                  "all_of": [
                    {
                      "operator": "equals",
                      "test": "rider_count",
                      "subject": "self",
                      "value": 0
                    },
                    {
                      "domain": "inventory",
                      "subject": "self",
                      "test": "has_equipment_tag",
                      "value": "minecraft:nautilus_armor"
                    },
                    {
                      "domain": "hand",
                      "subject": "other",
                      "test": "has_equipment",
                      "value": "shears"
                    },
                    {
                      "subject": "other",
                      "test": "is_sneak_held",
                      "value": false
                    }
                  ]
                }
              },
              "play_sounds": "armor.unequip_generic",
              "vibration": "shear"
            }
          ]
        },
        "minecraft:inventory": {
          "container_type": "horse"
        },
        "minecraft:is_tamed": {},
        "minecraft:rideable": {
          "crouching_skip_interact": true,
          "family_types": [
            "player"
          ],
          "interact_text": "action.interact.ride.horse",
          "on_rider_exit_event": "minecraft:on_player_dismount",
          "on_rider_enter_event": "minecraft:on_player_mount",
          "seats": {
            "position": [
              0,
              0.925,
              0
            ],
            "third_person_camera_radius": 7
          },
          "seat_count": 1
        }
      },
      "minecraft:zombie_nautilus_tame_saddled_on_ground": {
        "minecraft:dash_action": {
          "can_dash_underwater": false,
          "vertical_momentum": 0.1,
          "cooldown_time": 2,
          "horizontal_momentum": 42,
          "direction": "passenger"
        },
        "minecraft:environment_sensor": {
          "triggers": [
            {
              "event": "minecraft:on_saddled_in_water",
              "filters": {
                "test": "in_water"
              }
            }
          ]
        },
        "minecraft:input_ground_controlled": {}
      },
      "minecraft:zombie_nautilus_tame_unsaddled": {
        "minecraft:home": {
          "restriction_radius": 32,
          "restriction_type": "random_movement"
        }
      },
      "minecraft:zombie_nautilus_tameable": {
        "minecraft:behavior.tempt": {
          "items": [
            "pufferfish",
            "pufferfish_bucket"
          ],
          "on_tempt_end": {
            "event": "minecraft:on_stop_tempting"
          },
          "priority": 2,
          "speed_multiplier": 1.3
        },
        "minecraft:tameable": {
          "probability": 0.33,
          "tame_event": {
            "event": "minecraft:on_tame",
            "target": "self"
          },
          "tame_items": [
            {
              "item": "pufferfish_bucket",
              "result_item": "water_bucket:0"
            },
            "pufferfish"
          ]
        }
      },
      "minecraft:zombie_nautilus_wild": {
        "minecraft:rideable": {
          "family_types": [
            "drowned"
          ],
          "on_rider_enter_event": "minecraft:on_drowned_mount",
          "seats": {
            "position": [
              0,
              0.925,
              -0.2
            ]
          },
          "on_rider_exit_event": "minecraft:on_drowned_dismount",
          "pull_in_entities": true,
          "seat_count": 1
        }
      },
      "minecraft:zombie_nautilus_wild_angry": {
        "minecraft:angry": {
          "broadcast_anger": false,
          "broadcast_anger_when_dying": false,
          "broadcast_range": 16,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          },
          "duration": 20
        },
        "minecraft:behavior.aquatic_charge_attack": {
          "charge_speed": 0.96,
          "charge_cooldown_time": {
            "min": 4,
            "max": 4
          },
          "priority": 2
        }
      },
      "minecraft:zombie_nautilus_wild_calm": {
        "minecraft:on_target_acquired": {
          "event": "minecraft:become_angry",
          "target": "self"
        }
      },
      "minecraft:zombie_nautilus_wild_mounted": {
        "minecraft:behavior.mount_pathing": {
          "priority": 3,
          "target_dist": 2,
          "speed_multiplier": 1,
          "track_target": true
        },
        "minecraft:environment_sensor": {
          "triggers": {
            "event": "minecraft:on_drowned_dismount",
            "filters": {
              "operator": "equals",
              "test": "rider_count",
              "subject": "self",
              "value": 0
            }
          }
        },
        "minecraft:movement": {
          "value": 0.15
        },
        "minecraft:underwater_movement": {
          "value": 0.15
        }
      },
      "minecraft:zombie_nautilus_wild_unmounted": {
        "minecraft:behavior.nearest_attackable_target": {
          "reselect_targets": true,
          "attack_interval": {
            "min": 120,
            "max": 180
          },
          "target_acquisition_probability": 0.5,
          "must_see": true,
          "within_radius": 25,
          "must_see_forget_duration": 17,
          "entity_types": [
            {
              "filters": {
                "any_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "value": "pufferfish"
                  }
                ]
              },
              "max_dist": 35
            }
          ],
          "priority": 5
        }
      }
    },
    "events": {
      "minecraft:on_saddled_in_water": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame_saddled_in_water"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame_saddled_on_ground"
          ]
        }
      },
      "minecraft:on_drowned_dismount": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_unmounted",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_tameable",
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_mounted"
          ]
        }
      },
      "minecraft:on_saddled": {
        "sequence": [
          {
            "filters": { // Make sure Zombie Nautilus switches to player-controlled if saddle is added while player is riding
              "test": "rider_count",
              "operator": ">",
              "subject": "self",
              "value": 0
            },
            "trigger": "minecraft:switch_to_player_controlled"
          },
          {
            "add": {
              "component_groups": [
                "minecraft:zombie_nautilus_tame_saddled"
              ]
            },
            "remove": {
              "component_groups": [
                "minecraft:zombie_nautilus_tame_unsaddled"
              ]
            },
            "set_home_position": {}
          },
          {
            "filters": {
              "test": "in_water"
            },
            "trigger": "minecraft:on_saddled_in_water"
          },
          {
            "filters": {
              "test": "in_water",
              "value": false
            },
            "trigger": "minecraft:on_saddled_out_of_water"
          },
          {
            "play_sound": {
              "sound": "saddle"
            }
          }
        ]
      },
      "minecraft:become_angry": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_angry"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_calm",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_tameable"
          ]
        }
      },
      "minecraft:on_armor_equip": {
        "play_sound": {
          "sound": "armor.equip_generic"
        }
      },
      "minecraft:entity_spawned": {
        "sequence": [
          {
            "trigger": "minecraft:spawn_wild"
          },
          {
            "first_valid": [
              {
                "filters": {
                  "all_of": [
                    {
                      "test": "has_biome_tag",
                      "value": "ocean"
                    },
                    {
                      "test": "has_biome_tag",
                      "value": "warm"
                    },
                    {
                      "test": "has_biome_tag",
                      "operator": "not",
                      "value": "deep"
                    }
                  ]
                },
                "set_property": {
                  "minecraft:variant": "coral"
                }
              }
            ]
          }
        ]
      },
      "minecraft:on_player_dismount": {
        "set_home_position": {},
        "trigger": "minecraft:switch_to_ai_controlled"
      },
      "minecraft:on_calm": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_calm",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_tameable"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_angry"
          ]
        }
      },
      "minecraft:on_unleashed": {
        "set_home_position": {}
      },
      "minecraft:on_drowned_mount": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_mounted"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild_unmounted",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_tameable",
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        }
      },
      "minecraft:on_player_mount": {
        "filters": {
          "test": "has_component",
          "value": "minecraft:is_saddled"
        },
        "trigger": "minecraft:switch_to_player_controlled"
      },
      "minecraft:on_saddled_out_of_water": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame_saddled_on_ground"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame_saddled_in_water"
          ]
        }
      },
      "minecraft:on_stop_tempting": {
        "set_home_position": {}
      },
      "minecraft:on_tame": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame",
            "minecraft:zombie_nautilus_tame_unmounted",
            "minecraft:zombie_nautilus_tame_unsaddled"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild",
            "minecraft:zombie_nautilus_wild_unmounted",
            "minecraft:zombie_nautilus_wild_calm",
            "minecraft:zombie_nautilus_tameable",
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        },
        "set_home_position": {}
      },
      "minecraft:on_unsaddled": {
        "sequence": [
          {
            "filters": { // Make sure dismount event is played if saddle is removed while player is riding
              "test": "rider_count",
              "operator": ">",
              "subject": "self",
              "value": 0
            },
            "trigger": "minecraft:on_player_dismount"
          },
          {
            "add": {
              "component_groups": [
                "minecraft:zombie_nautilus_tame_unsaddled"
              ]
            },
            "remove": {
              "component_groups": [
                "minecraft:zombie_nautilus_tame_saddled",
                "minecraft:zombie_nautilus_tame_saddled_in_water",
                "minecraft:zombie_nautilus_tame_saddled_on_ground"
              ]
            },
            "set_home_position": {}
          }
        ]
      },
      "minecraft:spawn_tame": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_tame",
            "minecraft:zombie_nautilus_tame_unmounted",
            "minecraft:zombie_nautilus_tame_unsaddled",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        }
      },
      "minecraft:spawn_wild": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_wild",
            "minecraft:zombie_nautilus_wild_unmounted",
            "minecraft:zombie_nautilus_wild_calm",
            "minecraft:zombie_nautilus_leashable",
            "minecraft:zombie_nautilus_tameable",
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        }
      },
      "minecraft:switch_to_ai_controlled": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_player_controlled"
          ]
        }
      },
      "minecraft:switch_to_player_controlled": {
        "add": {
          "component_groups": [
            "minecraft:zombie_nautilus_player_controlled"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:zombie_nautilus_ai_controlled"
          ]
        }
      }
    }
  }
}