//This JSON was modified by LateLag (@LateLagMC). Please do not use this document without permission.
{
  "format_version": "1.10.0",
  "minecraft:attachable": {
    "description": {
      "identifier": "minecraft:crossbow",
      "materials": {
        "default": "entity_alphatest",
        "enchanted": "entity_alphatest_glint"
      },
      "textures": {
        "default": "textures/items/crossbow_standby",
        "crossbow_pulling_0": "textures/items/crossbow_pulling_0",
        "crossbow_pulling_1": "textures/items/crossbow_pulling_1",
        "crossbow_pulling_2": "textures/items/crossbow_pulling_2",
        "crossbow_arrow": "textures/items/crossbow_arrow",
        "crossbow_rocket": "textures/items/crossbow_firework",
        "enchanted": "textures/misc/enchanted_item_glint"
      },
      "geometry": {
        "default": "geometry.crossbow_standby",
        "crossbow_pulling_0": "geometry.crossbow_pulling_0",
        "crossbow_pulling_1": "geometry.crossbow_pulling_1",
        "crossbow_pulling_2": "geometry.crossbow_pulling_2",
        "crossbow_arrow": "geometry.crossbow_arrow",
        "crossbow_rocket": "geometry.crossbow_rocket"
      },
      "animations": {
        "wield": "animation.crossbow.wield",
        "wield_offhand": "animation.crossbow.wield_offhand",
        "wield_first_person_pull": "animation.crossbow.wield_first_person_pull",
        "wield_first_person": "animation.crossbow.wield_first_person"
      },
      "scripts": {
        "pre_animation": [
          "variable.charge_amount = math.clamp((query.main_hand_item_max_duration - (query.main_hand_item_use_duration - query.frame_alpha + 1.0)) / 10.0, 0.0, 2.0f) / 2.0;",
          "variable.animation_frame = c.item_slot == 'main_hand' ? query.get_animation_frame : 0;",
          "variable.is_in_offhand = c.item_slot == 'off_hand';",
          "variable.is_first_person = c.is_first_person;"
        ],
        "animate": [
          {
            "wield": "c.item_slot == 'main_hand'"
          },
          {
            "wield_offhand": "variable.is_in_offhand"
          },
          {
            "wield_first_person_pull": "query.main_hand_item_use_duration > 0.0f && c.is_first_person && c.item_slot == 'main_hand'"
          },
          {
            "wield_first_person": "query.item_is_charged && c.is_first_person && c.item_slot == 'main_hand'"
          }
        ]
      },
      "render_controllers": [ "controller.render.crossbow" ]
    }
  }
}
