WIP: Survival inventory and mcl_chest formspec overhaul. #1

Closed
Ghost wants to merge 20 commits from formspec_list into formspec-v4
1 changed files with 46 additions and 15 deletions
Showing only changes of commit f488d87b45 - Show all commits

View File

@ -1299,27 +1299,58 @@ local function formspec_shulker_box(name)
name = S("Shulker Box")
end
return table.concat({
local margin = mcl_formspec.margin
local padding = mcl_formspec.padding
local padding_slim = mcl_formspec.padding_slim
local bu = mcl_formspec.itemslot_bu
local iu = mcl_formspec.itemslot_iu
local label_color = mcl_formspec.label_color
local label_height = mcl_formspec.label_height
local label_y_offset = mcl_formspec.label_y_offset
local shulker_box_formspec = table.concat{
"label[",
padding - bu, ",", padding_slim + label_y_offset, ";",
F(C(mcl_formspec.label_color, name)),
"]",
mcl_formspec.create_itemslot_bg(padding, padding_slim + label_height, 9, 3),
"list[context;main;",
padding, ",", padding_slim + label_height, ";",
"9,3;",
"]",
}
local inventory_label_y = 2 * padding_slim + label_height + 3 * iu
local inventory_formspec = table.concat{
"label[",
padding - bu, ",", inventory_label_y + label_y_offset, ";",
F(C(mcl_formspec.label_color, S("Crafting"))),
"]",
mcl_formspec.create_itemslot_bg(padding, inventory_label_y + label_height, 9, 3),
mcl_formspec.create_itemslot_bg(padding, inventory_label_y + 3 * iu + padding + label_height, 9, 1),
"list[current_player;main;",
padding, ",", inventory_label_y + label_height, ";",
"9,3;9",
"]",
"list[current_player;main;",
padding, ",", inventory_label_y + 3 * iu + padding + label_height, ";",
"9,1;",
"]",
}
return table.concat{
"formspec_version[4]",
"size[11.75,10.425]",
"size[", 2 * padding + 9 * iu - 2 * bu, ",", 2 * padding + 7 * iu + 2 * (padding_slim + label_height) - 2 * bu, "]",
mcl_formspec.label_style,
mcl_formspec.itemslot_style,
"label[0.375,0.375;"..F(C(mcl_formspec.label_color, name)).."]",
mcl_formspec.create_itemslot_bg(0.375, 0.75, 9, 3),
"list[context;main;0.375,0.75;9,3;]",
"label[0.375,4.7;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
mcl_formspec.create_itemslot_bg(0.375, 5.1, 9, 3),
"list[current_player;main;0.375,5.1;9,3;9]",
mcl_formspec.create_itemslot_bg(0.375, 9.05, 9, 1),
"list[current_player;main;0.375,9.05;9,1;]",
shulker_box_formspec,
inventory_formspec,
"listring[context;main]",
"listring[current_player;main]",
})
}
end
local function set_shulkerbox_meta(nmeta, imeta)