{
  "format_version": "1.21.110",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:happy_ghast",
      "spawn_category": "creature",
      "is_spawnable": true,
      "is_summonable": true,
      "properties": {
        "minecraft:can_move": {
          "type": "bool",
          "default": true,
          "client_sync": true
        }
      }
    },

    "components": {
      "minecraft:type_family": {
        "family": [ "happy_ghast", "mob" ]
      },
      "minecraft:collision_box": {
        "width": 4.0,
        "height": 4.0
      },
      "minecraft:physics": {
        "has_gravity": false
      },
      "minecraft:can_fly": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:follow_range": {
        "value": 16,
        "max": 16
      },
      "minecraft:is_tamed": {
      },
      "minecraft:leashable": {
        "on_unleash": {
          "event": "minecraft:on_unleashed",
          "target": "self"
        },
        "presets": [
          {
            "hard_distance": 10,
            "max_distance": 14
          }
        ]
      },
      "minecraft:nameable": {
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava" },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "cause": "fall",
            "deals_damage": "no"
          }
        ]
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:renders_when_invisible": {
      },
      "minecraft:despawn": {
        "despawn_from_distance": {}
      },
      "minecraft:behavior.float": {
        "priority": 0
      },
      "minecraft:body_rotation_always_follows_head": {
      }
    },

    "component_groups": {
      "minecraft:baby": {
        "minecraft:is_baby": {
        },
        "minecraft:scale": {
          "value": 0.2375 // Resulting in a final size of 0.95.
        },
        "minecraft:health": {
          "value": 20,
          "max": 20
        },
        "minecraft:breathable": {
          "total_supply": 5,
          "suffocate_time": 0,
          "breathes_air": true,
          "breathes_water": true
        },
        "minecraft:ageable": {
          "duration": 1200,
          "feed_items": [
            "minecraft:snowball"
          ],
          "grow_up": {
            "event": "minecraft:ageable_grow_up",
            "target": "self"
          }
        },
        "minecraft:pushable": {
          "is_pushable": true,
          "is_pushable_by_piston": true
        },
        "minecraft:movement": {
          "value": 0.3
        },
        "minecraft:flying_speed": {
          "value": 0.0833333
        },
        "minecraft:movement.hover": {
        },
        "minecraft:navigation.hover": {
          "can_path_over_water": true,
          "avoid_damage_blocks": true,
          "can_path_from_air": true,
          "avoid_water": true
        },
        "minecraft:behavior.follow_mob": {
          "priority": 6,
          "search_range": 16,
          "stop_distance": 5,
          "speed_multiplier": 1.1,
          "use_home_position_restriction": true,
          "preferred_actor_type": "player",
          "filters": {
            "all_of": [
              { "test": "is_underwater", "subject": "other", "value": false },
              { "test": "is_baby", "subject": "other", "value": false },
              {
                "any_of": [
                  { "test": "is_family", "subject": "other", "value": "player" },
                  { "test": "is_family", "subject": "other", "value": "armadillo" },
                  { "test": "is_family", "subject": "other", "value": "bee" },
                  { "test": "is_family", "subject": "other", "value": "camel" },
                  { "test": "is_family", "subject": "other", "value": "cat" },
                  { "test": "is_family", "subject": "other", "value": "chicken" },
                  { "test": "is_family", "subject": "other", "value": "cow" },
                  { "test": "is_family", "subject": "other", "value": "donkey" },
                  { "test": "is_family", "subject": "other", "value": "fox" },
                  { "test": "is_family", "subject": "other", "value": "goat" },
                  { "test": "is_family", "subject": "other", "value": "happy_ghast" },
                  { "test": "is_family", "subject": "other", "value": "horse" },
                  { "test": "is_family", "subject": "other", "value": "skeleton_horse" },
                  { "test": "is_family", "subject": "other", "value": "llama" },
                  { "test": "is_family", "subject": "other", "value": "mule" },
                  { "test": "is_family", "subject": "other", "value": "ocelot" },
                  { "test": "is_family", "subject": "other", "value": "panda" },
                  { "test": "is_family", "subject": "other", "value": "parrot" },
                  { "test": "is_family", "subject": "other", "value": "pig" },
                  { "test": "is_family", "subject": "other", "value": "polar_bear" },
                  { "test": "is_family", "subject": "other", "value": "rabbit" },
                  { "test": "is_family", "subject": "other", "value": "sheep" },
                  { "test": "is_family", "subject": "other", "value": "sniffer" },
                  { "test": "is_family", "subject": "other", "value": "strider" },
                  { "test": "is_family", "subject": "other", "value": "villager" },
                  { "test": "is_family", "subject": "other", "value": "villager_v2" },
                  { "test": "is_family", "subject": "other", "value": "wolf"}
                ]
              }
            ]
          }
        },
        "minecraft:behavior.panic": {
          "priority": 2,
          "speed_multiplier": 2.0
        },
        "minecraft:behavior.tempt": {
          "priority": 3,
          "can_tempt_vertically": true,
          "items": [
            "minecraft:snowball"
          ],
          "speed_multiplier": 1.25,
          "within_radius": 16,
          "on_tempt_end": {
            "event": "minecraft:on_stop_tempting"
          }
        },
        "minecraft:behavior.random_hover": {
          "priority": 8,
          "xz_dist": 8,
          "y_dist": 8,
          "y_offset": -1,
          "interval": 1,
          "hover_height": [ 1, 4 ]
        },
        "minecraft:home": {
          "restriction_radius": 32,
          "restriction_type": "random_movement"
        }
      },
      "minecraft:adult": {
        "minecraft:health": {
          "value": 20,
          "max": 20
        },
        "minecraft:leashable_to": {
        },
        "minecraft:breathable": {
          "total_supply": 5,
          "suffocate_time": 0,
          "breathes_air": true,
          "breathes_water": false
        },
        "minecraft:navigation.float": {
          "can_path_over_water": true,
          "avoid_damage_blocks": true,
          "avoid_water": true
        },
        "minecraft:entity_sensor": {
          "find_players_only": true,
          "relative_range": false,
          "subsensors": [
            {
              "event": "minecraft:become_mobile",
              "cooldown": 0.0,
              "y_offset": 4.5,
              "range": [ 3.5, 2.0 ],
              "minimum_count": 0,
              "maximum_count": 0,
              // This filter must match exactly the one used by "minecraft:become_mobile".
              "event_filters": {
                "all_of": [
                  { "test": "is_vehicle_family", "subject": "other", "operator": "not", "value": "happy_ghast" },
                  { "test": "actor_health", "operator" : ">", "value": 0 }
                ]
              }
            },
            {
              "event": "minecraft:become_immobile",
              "cooldown": 0.0,
              "y_offset": 4.5,
              "range": [ 3.0, 1.5 ],
              "minimum_count": 1,
              // This filter must match exactly the one used by "minecraft:become_immobile".
              "event_filters": {
                "all_of": [
                  { "test": "is_vehicle_family", "subject": "other", "operator": "not", "value": "happy_ghast" },
                  { "test": "actor_health", "operator" : ">", "value": 0 }
                ]
              }
            }
          ]
        },
        "minecraft:experience_reward": {
          "on_death": "query.last_hit_by_player ? Math.Random(1,3) : 0"
        }
      },
      "minecraft:adult_mobile": {
        "minecraft:movement": {
          "value": 0.016
        },
        "minecraft:flying_speed": {
          "value": 0.016
        },
        "minecraft:knockback_resistance": {
          "value": 0.0
        },
        "minecraft:pushable": {
          "is_pushable": true,
          "is_pushable_by_piston": true
        },
        "minecraft:behavior.float_wander": {
          "priority": 7,
          "must_reach": true,
          "random_reselect": true,
          "navigate_around_surface": true,
          "additional_collision_buffer": true,
          "allow_navigating_through_liquids": false,
          "use_home_position_restriction": true,
          "surface_xz_dist": 16,
          "surface_y_dist": 16,
          "float_duration": [2.0, 7.0]
        }
      },
      "minecraft:adult_immobile": {
        "minecraft:movement": {
          "value": 0.0
        },
        "minecraft:flying_speed": {
          "value": 0.0
        },
        "minecraft:knockback_resistance": {
          "value": 1.0
        },
        "minecraft:pushable": {
          "is_pushable": false,
          "is_pushable_by_piston": true
        },
        "minecraft:body_rotation_blocked": {
        },
        "minecraft:rotation_axis_aligned": {
        },
        "minecraft:is_collidable": {
        }
      },
      "minecraft:adult_unharnessed": {
        "minecraft:behavior.float_tempt": {
          "priority": 4,
          "can_tempt_vertically": true,
          "items": [
            "minecraft:snowball",
            "minecraft:black_harness",
            "minecraft:blue_harness",
            "minecraft:brown_harness",
            "minecraft:cyan_harness",
            "minecraft:gray_harness",
            "minecraft:green_harness",
            "minecraft:light_blue_harness",
            "minecraft:light_gray_harness",
            "minecraft:lime_harness",
            "minecraft:magenta_harness",
            "minecraft:orange_harness",
            "minecraft:pink_harness",
            "minecraft:purple_harness",
            "minecraft:red_harness",
            "minecraft:white_harness",
            "minecraft:yellow_harness"
          ],
          "within_radius": 16,
          "stop_distance": 7,
          "on_tempt_end": {
            "event": "minecraft:on_stop_tempting"
          }
        },
        "minecraft:home": {
          "restriction_radius": 64,
          "restriction_type": "random_movement"
        },
        "minecraft:interact": {
          "interactions": [
            {
              "on_interact": {
                "filters": {
                  "any_of": [
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "black_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "blue_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "brown_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "cyan_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "gray_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "green_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "light_blue_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "light_gray_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "lime_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "magenta_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "orange_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "pink_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "purple_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "red_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "white_harness" },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "yellow_harness" }
                  ]
                },
                "event": "minecraft:on_harnessed",
                "target": "self"
              },
              "use_item": true,
              "equip_item_slot": "slot.armor.body",
              "play_sounds": "armor.equip_generic",
              "interact_text": "action.interact.equipharness"
            }
          ]
        }
      },
      "minecraft:adult_harnessed": {
        "minecraft:home": {
          "restriction_radius": 32,
          "restriction_type": "random_movement"
        },
        "minecraft:rideable": {
          "seat_count": 4,
          "family_types": [ "player" ],
          "dismount_mode": "on_top_center",
          "on_rider_enter_event": "minecraft:on_passenger_mount",
          "on_rider_exit_event": "minecraft:on_passenger_dismount",
          "interact_text": "action.interact.ride.horse",
          "seats": [
            {
              "min_rider_count": 0,
              "max_rider_count": 4,
              "position": [ 0.0, 3.8, 1.7 ],
              "third_person_camera_radius": 8.0,
              "camera_relax_distance_smoothing": 6.0
            },
            {
              "min_rider_count": 1,
              "max_rider_count": 4,
              "position": [ -1.7, 3.8, 0.0 ],
              "third_person_camera_radius": 8.0,
              "camera_relax_distance_smoothing": 6.0
            },
            {
              "min_rider_count": 2,
              "max_rider_count": 4,
              "position": [ 0.0, 3.8, -1.7 ],
              "third_person_camera_radius": 8.0,
              "camera_relax_distance_smoothing": 6.0
            },
            {
              "min_rider_count": 3,
              "max_rider_count": 4,
              "position": [ 1.7, 3.8, 0.0 ],
              "third_person_camera_radius": 8.0,
              "camera_relax_distance_smoothing": 6.0
            }
          ]
        },
        "minecraft:free_camera_controlled": {
          "strafe_speed_modifier": 1.0,
          "backwards_movement_modifier": 0.5
        },
        "minecraft:vertical_movement_action": {
          "vertical_velocity": 0.5
        },
        "minecraft:behavior.player_ride_tamed": {
          "priority": 1
        },
        "minecraft:behavior.float_tempt": {
          "priority": 5,
          "can_tempt_vertically": true,
          "items": [
            "minecraft:snowball"
          ],
          "within_radius": 16,
          "stop_distance": 7,
          "on_tempt_end": {
            "event": "minecraft:on_stop_tempting"
          }
        },
        "minecraft:interact": {
          "interactions": [
            {
              "on_interact": {
                "filters": {
                  "all_of": [
                    { "test": "is_sneak_held", "subject": "other", "value": false },
                    { "test": "has_equipment", "subject": "other", "domain": "hand", "value": "shears" },
                    { "test": "rider_count", "subject": "self", "operator": "equals", "value": 0 }
                  ]
                },
                "event": "minecraft:on_unharnessed",
                "target": "self"
              },
              "hurt_item": 1,
              "drop_item_slot": "slot.armor.body",
              "drop_item_y_offset": 5,
              "play_sounds": "armor.unequip_generic",
              "interact_text": "action.interact.removeharness",
              "vibration": "shear"
            }
          ]
        }
      },
      "minecraft:adult_with_passengers": {
        "minecraft:ambient_sound_interval": {
          "value": 30.0
        }
      },
      "minecraft:adult_without_passengers": {
        "minecraft:ambient_sound_interval": {
          "value": 5.0
        }
      }
    },

    "events": {
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 95,
            "trigger": "minecraft:spawn_adult"
          },
          {
            "weight": 5,
            "trigger": "minecraft:spawn_baby"
          }
        ]
      },
      "minecraft:spawn_adult": {
        "add": {
          "component_groups": [
            "minecraft:adult",
            "minecraft:adult_mobile",
            "minecraft:adult_unharnessed",
            "minecraft:adult_without_passengers"
          ]
        },
        "set_property": {
          "minecraft:can_move": true
        }
      },
      "minecraft:spawn_baby": {
        "add": {
          "component_groups": [
            "minecraft:baby"
          ]
        }
      },
      "minecraft:ageable_grow_up": {
        "add": {
          "component_groups": [
            "minecraft:adult",
            "minecraft:adult_mobile",
            "minecraft:adult_unharnessed",
            "minecraft:adult_without_passengers"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:baby"
          ]
        },
        "set_property": {
          "minecraft:can_move": true
        }
      },
      "minecraft:become_immobile": {
        "filters": {
          "test": "bool_property", "domain": "minecraft:can_move", "value": true
        },
        "add": {
          "component_groups": [
            "minecraft:adult_immobile"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:adult_mobile"
          ]
        },
        "set_property": {
          "minecraft:can_move": false
        },
        "stop_movement": {
        }
      },
      "minecraft:become_mobile": {
        "filters": {
          "test": "bool_property", "domain": "minecraft:can_move", "value": false
        },
        "add": {
          "component_groups": [
            "minecraft:adult_mobile"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:adult_immobile"
          ]
        },
        "set_property": {
          "minecraft:can_move": true
        }
      },
      "minecraft:on_harnessed": {
        "remove": {
          "component_groups": [
            "minecraft:adult_unharnessed"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:adult_harnessed"
          ]
        },
        "set_home_position": {}
      },
      "minecraft:on_unharnessed": {
        "remove": {
          "component_groups": [
            "minecraft:adult_harnessed"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:adult_unharnessed"
          ]
        },
        "set_home_position": {}
      },
      "minecraft:on_unleashed": {
        "set_home_position": {}
      },
      "minecraft:on_passenger_mount": {
        "sequence": [
          {
            "filters": {
              "test": "rider_count", "subject": "self", "operator": "equals", "value": 1
            },
            "add": {
              "component_groups": [
                "minecraft:adult_with_passengers"
              ]
            },
            "remove": {
              "component_groups": [
                "minecraft:adult_without_passengers"
              ]
            },
            "play_sound": {
              "sound": "attach"
            }
          }
        ]
      },
      "minecraft:on_passenger_dismount": {
        "sequence": [
          {
            "filters": {
              "test": "rider_count", "subject": "self", "operator": "equals", "value": 0
            },
            "add": {
              "component_groups": [
                "minecraft:adult_without_passengers"
              ]
            },
            "remove": {
              "component_groups": [
                "minecraft:adult_with_passengers"
              ]
            },
            "play_sound": {
              "sound": "detach"
            }
          },
          {
            "set_home_position": {},
            "trigger": "minecraft:on_player_detected_above"
          }
        ]
      },
      "minecraft:on_stop_tempting": {
        "set_home_position": {}
      }
    }
  }
}
