Screens
Available since 0.1.0
Give a machine a screen. Size, background, title, slots, gauges, the progress arrow, the status light and the player inventory.
A screen (a "GUI") is what opens when a player right-clicks a machine. You describe it with a size and a list of widgets: slots, gauges, a progress arrow, the player inventory. Players can move items with every normal Minecraft shortcut: clicking, Shift-clicking, dragging and the number keys all work as they do in a chest.
Where the screen lives
A machine can describe its screen right inside its own file, under gui:
{
"schema_version": 1,
"id": "mypack:iron_smelter",
"display_name": "Iron Smelter",
"carrier": {
"type": "single_block"
},
"storages": [
{
"id": "input",
"resource_type": "foundry_apparatus:item",
"slots": 1,
"direction": "in"
}
],
"gui": {
"width": 176,
"height": 166,
"widgets": [
{
"id": "input",
"type": "foundry_apparatus:item_slot",
"x": 79,
"y": 34,
"width": 18,
"height": 18,
"target_binding": "input"
}
]
}
}Or the screen can have its own file in foundry_apparatus/guis/, and the machine points at it by id. This is handy when several machines share one screen, and it lets you change the screen with /reload, without restarting the game:
{
"schema_version": 1,
"id": "mypack:iron_smelter",
"width": 176,
"height": 166,
"widgets": [
{
"id": "input",
"type": "foundry_apparatus:item_slot",
"x": 79,
"y": 34,
"width": 18,
"height": 18,
"target_binding": "input"
}
]
}"gui": "mypack:iron_smelter"Size, background and title
{
"width": 176,
"height": 166,
"background_texture": "mypack:gui/iron_smelter",
"title": "center"
}widthandheightare the size of the window in pixels.176by166is the size of a furnace.background_textureis an image from your pack's assets.mypack:gui/iron_smeltermeans the fileassets/mypack/textures/gui/iron_smelter.pnginside your pack folder. Without it, the screen draws a plain panel in the style of vanilla Minecraft.titleplaces the machine's name:center(default),left,rightorhidden.
Widgets
Every widget has an id, a type, a position and a size. x and y are counted in pixels from the top-left corner of the window, going right and down:
{
"id": "input",
"type": "foundry_apparatus:item_slot",
"x": 55,
"y": 34,
"width": 18,
"height": 18,
"target_binding": "input"
}target_binding connects the widget to one of the machine's storages, by the storage's id. Some widgets take extra options in params.
Item slot
foundry_apparatus:item_slot shows one slot of an item storage. A slot is 18 by 18 pixels.
When a storage has several slots, each item_slot shows the next one, in order. To choose a specific slot, give its number in params (counting starts at 0):
{
"id": "second_output",
"type": "foundry_apparatus:item_slot",
"x": 116,
"y": 34,
"width": 18,
"height": 18,
"target_binding": "output",
"params": {
"slot": 1
}
}Gauge
foundry_apparatus:resource_gauge shows how full a tank or battery is. Hovering it shows the exact amount, such as 4,000 / 8,000 mB:
{
"id": "water",
"type": "foundry_apparatus:resource_gauge",
"x": 8,
"y": 18,
"width": 16,
"height": 52,
"target_binding": "water_in",
"params": {
"direction": "up"
}
}direction is the way it fills: up (default), down, left or right.
Players can click a fluid gauge holding a bucket: a full bucket pours into the tank, an empty bucket fills from it. Only whole buckets move, exactly like vanilla buckets.
Progress arrow
foundry_apparatus:progress_bar is the arrow that fills while a recipe runs. It needs no binding:
{
"id": "progress",
"type": "foundry_apparatus:progress_bar",
"x": 79,
"y": 35,
"width": 24,
"height": 16,
"params": {
"direction": "right"
}
}Status light
foundry_apparatus:status_indicator is a small light showing what the machine is doing. Hovering it explains the state and, when the machine is stuck, why (for example, the output is full):
{
"id": "status",
"type": "foundry_apparatus:status_indicator",
"x": 8,
"y": 72,
"width": 8,
"height": 8
}Player inventory
foundry_apparatus:player_inventory places the player's inventory and hotbar. The standard place for a 176 by 166 window is:
{
"id": "inventory",
"type": "foundry_apparatus:player_inventory",
"x": 7,
"y": 83,
"width": 162,
"height": 76
}Leave it out for screens that only show information.
Side configuration
When the machine lets players choose which side does what, a tab appears on the right of the screen by itself. It is explained in Sides and Automation.
What is next
Screens can grow beyond one window, with extra panels and buttons: see Panels and Buttons. Every field is listed in the GUI reference.