Skip to content
cubex2 edited this page May 28, 2017 · 4 revisions

All GUIs

Some attributes are used by all types of GUIs:

{
	"id" : "mygui"
}
  • id: This is the unique id of the GUI. This is used to reference the GUI in blocks. This has to be all lowercase and must not contain spaces. It only has to be unique in your mod.

Container

Type name: gui:container

This gui can have inventory slots. The following attributes are available:

{
  "width": 176,
  "height": 166,
  "bg": "mymod:textures/gui/container/mybg.png",
  "bgTexX": 0,
  "bgTexY": 0,
  "slots": [
    {
      "name": "inv1",
      "rows": 3,
      "columns": 9,
      "x": 8,
      "y": 17,
      "dropOnClose": true,
      "spacingX": 18,
      "spacingY": 18
    },
    {
      "name": "player",
      "firstSlot": 9,
      "rows": 3,
      "columns": 9,
      "x": 8,
      "y": 84
    },
    {
      "name": "player",
      "rows": 1,
      "columns": 9,
      "x": 8,
      "y": 142
    }
  ],
  "shiftClickRules": [
    {
      "from": [0, 26],
      "to": [62, 27]
    },
    {
      "from": [27, 62],
      "to": [0, 26],
      "filter": "ore:stickWood"
    }
  ],
  "labels": [
    {
      "text": "container.chest",
      "x": 8,
      "y": 6,
      "color": "red",
      "dropShadow": true
    },
    {
      "text": "container.inventory",
      "x": 8,
      "y": 73
    }
  ],
  "progressBars": [
    {
      "source": "machine:burnTime",
      "x": 56,
      "y": 36,
      "width": 14,
      "height": 13,
      "texX": 176,
      "texY": 0,
      "direction": "up"
    }
  ],
  "fluidDisplays": [
    {
      "source": "tank1",
      "x": 50,
      "y": 60,
      "width": 32,
      "height": 100,
      "overlayTexX": 166,
      "overlayTexY": 0
    }
  ]
}
  • width: This defines the width of the GUI. Default value is 176.
  • height: This defines the width of the GUI. Default value is 166.
  • bg: This is a ResourceLocation defining the background texture for the gui.
  • bgTexX, bgTexY: These define where in the background texture the actual background is. The rectangle that is being drawn is at (bgTexX, bgTexY) and its size is (width, height). Default values are 0.
  • slots: This is a list of inventory slots for the GUI. The order of this list is relevant for the shift-click rules.
    • name: This is the name of the inventory. For inventories in tile enties, this is the value used for the name attribute of the inventory module.
    • firstSlot: This is the index of the first slot from the inventory that is being used. This is usefull if you want one inventory to split into multiple areas. The player inventory, for example, is split into the hotbar and the non-hotbar areas. The default value is 0.
    • rows, columns: These define in how many rows and columns is separated in. They also define how many slots are added (rows * columns = totalSlots). Default values are 1.
    • x, y: These define where the top-left slot is positioned in the GUI, relative to the background.
    • dropOnClose: This defines whether the items in the slots should be dropped when closing the GUI. Default value is false.
    • spacingX, spacingY: The defines the spacing between the individual slots. Default value is 18.
  • shiftClickRules: This a list of rules that define what happens when you shift-click a slot. In the example above, the first slots have indices 0 to 26, the second 27 to 53 and the last 54 to 62.
    • from: This defines the index of the first and last slot that the rule applies to.
    • to: This defines the index of the first and last slot that a itemstack is transferred to. If the first index is greater than the second index, it'll search in reverse order for a valid slot to put the stack to.
    • filter: This is a ItemFilter that defines what items this rule applies to. Default value allows all items.
  • labels: This is a list of labels that are drawn onto the GUI.
    • text: The text that is being drawn.
    • x, y: The position of the text relative to the background.
    • color: This is a Color defining the color of the text. Default value is "404040".
    • dropShadow: Whether to draw the drop shadow. Default value is false.
  • progressBars: This is a list of progress bars that are drawn onto the GUI.
    • x, y: The position of the bar relative to the background.
    • texX, texY: These define where in the background texture the progress bar is located.
    • width, height: The width and height of the bar when completely filled.
    • direction: The direction in which the bar fills. One of: up, down, left, right.
    • source: This defines where the progress for the bar comes from. For example, machine:burnTime, uses the burnTime from the tile entity module with the name machine.
  • fluidDisplays: This is a list of fluid displays that are drawn onto the GUI.
    • x, y: The position of the display relative to the background.
    • width, height: The size of display.
    • overlayTexX, overlayTexY: If the tank has a overlay that is drawn onto the fluid, these define where in the background texture that overlay is located. The overlay has the same size as the display itself.
    • source: This defines where the data for the display is from. This can, for example, be the id of a tank module.

Clone this wiki locally