Add armor slot images to armor slots in creative

This commit is contained in:
Wuzzy 2017-03-09 17:49:02 +01:00
parent 739b5f6d7e
commit e296b91936
1 changed files with 18 additions and 1 deletions

View File

@ -209,6 +209,23 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, p
local inv_bg = "crafting_inventory_creative.png" local inv_bg = "crafting_inventory_creative.png"
if name == "inv" then if name == "inv" then
inv_bg = "crafting_inventory_creative_survival.png" inv_bg = "crafting_inventory_creative_survival.png"
-- Background images for armor slots (hide if occupied)
local armor_slot_imgs = ""
local inv = player:get_inventory()
if inv:get_stack("armor", 2):is_empty() then
armor_slot_imgs = armor_slot_imgs .. "image[2.5,1.3;1,1;crafting_slot_head.png]"
end
if inv:get_stack("armor", 3):is_empty() then
armor_slot_imgs = armor_slot_imgs .. "image[2.5,2.75;1,1;crafting_slot_torso.png]"
end
if inv:get_stack("armor", 4):is_empty() then
armor_slot_imgs = armor_slot_imgs .. "image[5.5,1.3;1,1;crafting_slot_legs.png]"
end
if inv:get_stack("armor", 5):is_empty() then
armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;crafting_slot_feet.png]"
end
-- Survival inventory slots -- Survival inventory slots
main_list = "list[current_player;main;0,3.75;9,3;9]".. main_list = "list[current_player;main;0,3.75;9,3;9]"..
-- armor -- armor
@ -216,7 +233,7 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, p
"list[detached:"..playername.."_armor;armor;2.5,2.75;1,1;2]".. "list[detached:"..playername.."_armor;armor;2.5,2.75;1,1;2]"..
"list[detached:"..playername.."_armor;armor;5.5,1.3;1,1;3]".. "list[detached:"..playername.."_armor;armor;5.5,1.3;1,1;3]"..
"list[detached:"..playername.."_armor;armor;5.5,2.75;1,1;4]".. "list[detached:"..playername.."_armor;armor;5.5,2.75;1,1;4]"..
--TODO: armor_slot_imgs.. armor_slot_imgs..
-- crafting guide button -- crafting guide button
"image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]".. "image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]"..
"tooltip[__mcl_craftguide;Show crafting recipes]".. "tooltip[__mcl_craftguide;Show crafting recipes]"..