{
  "format_version": "1.10.0",
  "animation_controllers": {
    "controller.animation.silverlabs_nat.otter.eat": {
      "initial_state": "default",
      "states": {
        "default": {
          "on_entry": [
            "v.eat_step = 0;",
            "v.float_delay = query.life_time + 1;",
            "@s silverlabs_nat:not_floating"
          ],
          "transitions": [
            {
              "float": "(query.life_time > (v.float_delay ?? 0)) && q.is_item_equipped(0) && q.is_in_water && (math.random_integer(1,100) == 100)"
            },
            {
              "give_to_player": "(query.life_time > (v.float_delay ?? 0)) && q.is_item_equipped(0) && (math.random_integer(1,100) == 100)"
            }
          ]
        },
        "float": {
          "on_entry": [
            "@s silverlabs_nat:is_floating",
            "v.eat_delay = query.life_time + math.random(2,5);"
          ],
          "transitions": [
            {
              "default": "!q.is_item_equipped(0) || !q.is_in_water || (q.modified_move_speed >= 0.075)"
            },
            {
              "eat": "(query.life_time > (v.eat_delay ?? 0))"
            }
          ]
        },
        "eat": {
          "on_entry": [
            "v.eat_step = (v.eat_step ?? 0) + 1;",
            "v.eat_delay = query.life_time + 0.15;"
          ],
          "transitions": [
            {
              "munch": "((v.eat_step ?? 0) < 3) && (query.life_time > (v.eat_delay ?? 0))"
            },
            {
              "digest": "(query.life_time > (v.eat_delay ?? 0))"
            }
          ]
        },
        "munch": {
          "on_entry": ["/playsound mob.fox.eat @a ~ ~ ~"],
          "transitions": [
            {
              "eat": "1"
            }
          ]
        },
        "digest": {
          "on_entry": [
            "/playsound mob.fox.eat @a ~ ~ ~ 1 1.2",
            "/replaceitem entity @s slot.inventory 0 air",
            "/replaceitem entity @s slot.weapon.mainhand 0 air",
            "@s silverlabs_nat:otter_on_finish_eat",
            "@s silverlabs_nat:not_floating"
          ],
          "transitions": [
            {
              "default": "1"
            }
          ]
        },
        "give_to_player": {
          "on_entry": ["@s silverlabs_nat:give_item_to_player"],
          "transitions": [
            {
              "default": "!q.is_item_equipped(0)"
            }
          ]
        }
      }
    },
    "controller.animation.silverlabs_nat.otter.item_check": {
      "initial_state": "default",
      "states": {
        "default": {
          "transitions": [
            {
              "test": "q.is_item_equipped(0)"
            }
          ]
        },
        "test": {
          "on_entry": ["/scriptevent silverlabs_nat:otter_check"],
          "transitions": [
            {
              "default": "!q.is_item_equipped(0)"
            }
          ]
        }
      }
    }
  }
}
