Tweak tab positions in Creative

This commit is contained in:
Wuzzy 2017-11-21 23:23:56 +01:00
parent 7a8dad991b
commit eed223b3fe

View File

@ -139,18 +139,36 @@ local boffset = {} --
local hoch = {} local hoch = {}
local bg = {} local bg = {}
noffset["blocks"] = {-0.29,-0.25} local noffset_x_start = -0.24
noffset["deco"] = {0.98,-0.25} local noffset_x = noffset_x_start
noffset["redstone"] = {2.23,-0.25} local noffset_y = -0.25
noffset["rail"] = {3.495,-0.25} local next_noffset = function(id, right)
noffset["misc"] = {4.75,-0.25} if right then
noffset["nix"] = {8.99,-0.25} noffset[id] = { 8.94, noffset_y }
noffset["food"] = {-0.29,8.12} else
noffset["tools"] = {0.98,8.12} noffset[id] = { noffset_x, noffset_y }
noffset["combat"] = {2.23,8.12} noffset_x = noffset_x + 1.25
noffset["brew"] = {3.495,8.12} end
noffset["matr"] = {4.74,8.12} end
noffset["inv"] = {8.99,8.12}
-- Upper row
next_noffset("blocks")
next_noffset("deco")
next_noffset("redstone")
next_noffset("rail")
next_noffset("misc")
next_noffset("nix", true)
noffset_x = noffset_x_start
noffset_y = 8.12
-- Lower row
next_noffset("food")
next_noffset("tools")
next_noffset("combat")
next_noffset("brew")
next_noffset("matr")
next_noffset("inv", true)
for k,v in pairs(noffset) do for k,v in pairs(noffset) do
offset[k] = tostring(v[1]) .. "," .. tostring(v[2]) offset[k] = tostring(v[1]) .. "," .. tostring(v[2])
@ -293,61 +311,67 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, inv_siz
"image[9.033," .. tostring(slider_pos) .. ";0.78,"..tostring(slider_height) .. ";crafting_slider.png]".. "image[9.033," .. tostring(slider_pos) .. ";0.78,"..tostring(slider_height) .. ";crafting_slider.png]"..
"image_button[9.02,6.15;"..tostring(arrow_height)..",0.6;crafting_creative_down.png;creative_next;]" "image_button[9.02,6.15;"..tostring(arrow_height)..",0.6;crafting_creative_down.png;creative_next;]"
end end
local function tab(current, check)
local img local tab_icon = {
if current == check then blocks = "mcl_core:brick_block",
img = "crafting_creative_active.png" deco = "mcl_flowers:peony",
redstone = "mesecons:redstone",
rail = "mcl_minecarts:golden_rail",
misc = "mcl_buckets:bucket_lava",
nix = "mcl_compass:compass",
food = "mcl_core:apple",
tools = "mcl_core:axe_iron",
combat = "mcl_core:sword_gold",
brew = "mcl_potions:potion_water",
matr = "mcl_core:stick",
inv = "mcl_chests:chest",
}
local function tab(current_tab, this_tab)
local bg_img
if current_tab == this_tab then
bg_img = "crafting_creative_active.png"
else else
img = "crafting_creative_inactive.png" bg_img = "crafting_creative_inactive.png"
end end
return "image[" .. offset[check] .. ";1.5,1.44;" .. img .. hoch[check].. "]" .. return
"image[" .. boffset[check] .. ";1,1;crafting_creative_marker.png]" "item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]"..
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. hoch[this_tab].. "]" ..
"image[" .. boffset[this_tab] .. ";1,1;crafting_creative_marker.png]"
end end
local fnt = "" local fnt = ""
if name ~= "inv" then if name ~= "inv" then
fnt = "image[0,1;5,0.75;mcl_inventory_fnt_"..name..".png]" fnt = "image[0,1;5,0.75;mcl_inventory_fnt_"..name..".png]"
end end
formspec = "size[10,9.3]".. formspec = "size[10,9.3]"..
mcl_vars.inventory_header.. mcl_vars.inventory_header..
"background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]".. "background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]"..
"label[-5,-5;"..name.."]".. "label[-5,-5;"..name.."]"..
"item_image_button[-0.1,0;1,1;mcl_core:brick_block;blocks;]".. --build blocks
tab(name, "blocks") .. tab(name, "blocks") ..
"tooltip[blocks;Building Blocks]".. "tooltip[blocks;Building Blocks]"..
"item_image_button[1.15,0;1,1;mcl_flowers:peony;deco;]".. --decoration blocks
tab(name, "deco") .. tab(name, "deco") ..
"tooltip[deco;Decoration Blocks]".. "tooltip[deco;Decoration Blocks]"..
"item_image_button[2.415,0;1,1;mesecons:redstone;redstone;]".. --redstone
tab(name, "redstone") .. tab(name, "redstone") ..
"tooltip[redstone;Redstone]".. "tooltip[redstone;Redstone]"..
"item_image_button[3.693,0;1,1;mcl_minecarts:golden_rail;rail;]".. --transportation
tab(name, "rail") .. tab(name, "rail") ..
"tooltip[rail;Transportation]".. "tooltip[rail;Transportation]"..
"item_image_button[4.93,0;1,1;mcl_buckets:bucket_lava;misc;]".. --miscellaneous
tab(name, "misc") .. tab(name, "misc") ..
"tooltip[misc;Miscellaneous]".. "tooltip[misc;Miscellaneous]"..
"item_image_button[9.19,0;1,1;mcl_compass:compass;nix;]".. --search
tab(name, "nix") .. tab(name, "nix") ..
"tooltip[nix;Search Items]".. "tooltip[nix;Search Items]"..
fnt.. fnt..
"list[current_player;main;0,7;9,1;]".. "list[current_player;main;0,7;9,1;]"..
main_list.. main_list..
"item_image_button[-0.1,8.37;1,1;mcl_core:apple;food;]".. --foodstuff
tab(name, "food") .. tab(name, "food") ..
"tooltip[food;Foodstuffs]".. "tooltip[food;Foodstuffs]"..
"item_image_button[1.15,8.37;1,1;mcl_core:axe_iron;tools;]".. --tools
tab(name, "tools") .. tab(name, "tools") ..
"tooltip[tools;Tools]".. "tooltip[tools;Tools]"..
"item_image_button[2.415,8.37;1,1;mcl_core:sword_gold;combat;]".. --combat
tab(name, "combat") .. tab(name, "combat") ..
"tooltip[combat;Combat]".. "tooltip[combat;Combat]"..
"item_image_button[3.693,8.37;1,1;mcl_potions:potion_water;brew;]".. --brewing
tab(name, "brew") .. tab(name, "brew") ..
"tooltip[brew;Brewing]".. "tooltip[brew;Brewing]"..
"item_image_button[4.938,8.37;1,1;mcl_core:stick;matr;]".. --materials
tab(name, "matr") .. tab(name, "matr") ..
"tooltip[matr;Materials]".. "tooltip[matr;Materials]"..
"item_image_button[9.19,8.37;1,1;mcl_chests:chest;inv;]".. --inventory
tab(name, "inv") .. tab(name, "inv") ..
"tooltip[inv;Survival Inventory]".. "tooltip[inv;Survival Inventory]"..
"list[detached:trash;main;9,7;1,1;]".. "list[detached:trash;main;9,7;1,1;]"..