/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/

{
  "namespace": "matreduce",

  ///// Shared with Pocket Screen /////

  "one_touch_button@chem_common_pocket.one_touch_button": {
    "$take_all_place_all": "button.matreduce_take_all_place_all",
    "$coalesce_stack": "button.matreduce_coalesce_stack"
  },

  ///// Differs from Pocket Screen /////

  "title_label@edu_common.dark_label": {
    "layer": 2,
    "text": "materialreducer.title",
    "size": [ "100%", "default" ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "text_alignment": "center",
    "offset": [ 0, 4 ]
  },

  "input_slot@common.empty_panel": {
    "size": [ 18, 18 ],
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "offset": [ 0, 4 ],

    "controls": [
      {
        "slot@common.container_item": {
          "layer": 2,
          "$item_collection_name": "matreduce_input",
          "$button_ref": "matreduce.one_touch_button",
          "bindings": [
            {
              "binding_name": "#input_enabled",
              "binding_name_override": "#enabled"
            }
          ]
        }
      },
      {
        "disabled_overlay": {
          "type": "image",
          "layer": 4,
          "texture": "textures/ui/recipe_book_red_button",
          "bindings": [
            {
              "binding_name": "(not #input_enabled)",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  "connectors": {
    "type": "image",
    "texture": "textures/ui/material_reducer_connectors",
    "size": [ 108, 54 ],
    "offset": [ 0, 11 ],
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "layer": 4
  },

  "output_item": {
    "type": "panel",
    "grid_position": "$grid_position",
    "size": [ 18, 18 ],
    "controls": [
      {
        "slot@common.container_item": {
          "$offset|default": [ 0, 0 ],
          "offset": "$offset",
          "$item_collection_name": "matreduce_output"
        }
      }
    ]
  },

  "output_slots": {
    "type": "grid",
    "size": [ 130, 50 ],
    "offset": [ 4, 4 ],
    "anchor_from": "bottom_middle",
    "anchor_to": "bottom_middle",
    "grid_dimensions": [ 5, 2 ],
    "collection_name": "matreduce_output",
    "controls": [
      {
        "a@matreduce.output_item": {
          "$grid_position": [ 0, 0 ]
        }
      },
      {
        "b@matreduce.output_item": {
          "$grid_position": [ 1, 0 ]
        }
      },
      {
        "c@matreduce.output_item": {
          "$grid_position": [ 2, 0 ]
        }
      },
      {
        "d@matreduce.output_item": {
          "$grid_position": [ 3, 0 ]
        }
      },
      {
        "e@matreduce.output_item": {
          "$grid_position": [ 4, 0 ]
        }
      },
      {
        "f@matreduce.output_item": {
          "$grid_position": [ 0, 1 ],
          "$offset": [ 13, 0 ]
        }
      },
      {
        "g@matreduce.output_item": {
          "$grid_position": [ 1, 1 ],
          "$offset": [ 13, 0 ]
        }
      },
      {
        "h@matreduce.output_item": {
          "$grid_position": [ 2, 1 ],
          "$offset": [ 13, 0 ]
        }
      },
      {
        "i@matreduce.output_item": {
          "$grid_position": [ 3, 1 ],
          "$offset": [ 13, 0 ]
        }
      }
    ]
  },

  "top_half@common.empty_panel": {
    // Offset so it starts under the title label and within the frame, and goes down to the inventory
    "offset": [ 4, 14 ],
    "size": [ "100% - 8px", 85 ],
    "layer": 1,
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "controls": [
      { "input@matreduce.input_slot": {} },
      { "output@matreduce.output_slots": {} },
      { "connectors@matreduce.connectors": {} }
    ]
  },

  "content": {
    "type": "panel",
    "controls": [
      {
        "root_panel@common.root_panel": {
          "layer": 1,
          "$bottom_padding": 10,
          "size": [ 205, 200 ],
          "controls": [
            { "common_panel@common.common_panel": {} },
            { "title_label@matreduce.title_label": {} },
            { "top_half@matreduce.top_half": {} },
            {
              "inventory": {
                "type": "panel",
                "layer": 2,
                "offset": [ 0, -10 ],
                "controls": [
                  {
                    "inventory@common.inventory_panel_bottom_half_with_label": {
                      "size": [ 176, 93 ],
                      "anchor_from": "bottom_middle",
                      "anchor_to": "bottom_middle"
                    }
                  },
                  { "hotbar@common.hotbar_grid_template": {} },
                  { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
                ]
              }
            },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} }
          ]
        }
      },
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} } // Gamepad tool tips
    ]
  },

  "material_reducer@common.inventory_screen_common": {
    "$close_on_player_hurt|default": false,
    "close_on_player_hurt": "$close_on_player_hurt",
    "$screen_bg_content": "common.screen_background",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "matreduce.content"
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "matreduce_pocket.content"
      }
    ]
  }
}