Show player preview in creative inventory

This commit is contained in:
Wuzzy 2017-03-09 18:26:16 +01:00
parent e296b91936
commit 04daa1295b
2 changed files with 23 additions and 11 deletions

View file

@ -31,8 +31,6 @@ local function drop_fields(player, name)
end
end
local player_armor = {}
local function update_armor(player)
return
end
@ -47,16 +45,12 @@ local function set_inventory(player)
inv:set_size("craft", 4)
local player_name = player:get_player_name()
-- Show armor and player image
-- TODO: Use player.png to allow for custom skins
local img = "crafting_player2d.png"
local armor_img = ""
if show_armor then
armor_img = ""
if player_armor[player_name] ~= nil then
img = img .. player_armor[player_name]
end
end
local img_element = "image[0.6,0.2;3,4;"..img.."]"
local player_preview = "image[0.6,0.2;2,4;"..img.."]"
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
img = armor.textures[player_name].preview
local s1 = img:find("character_preview")
@ -64,7 +58,7 @@ local function set_inventory(player)
s1 = img:sub(s1+21)
img = "crafting_player2d.png"..s1
end
img_element = "image[1.1,0.2;2,4;"..img.."]"
player_preview = "image[1.1,0.2;2,4;"..img.."]"
end
local armor_slots = {"head", "torso", "legs", "feet"}
@ -78,7 +72,7 @@ local function set_inventory(player)
local form = "size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
mcl_vars.inventory_header..
img_element..
player_preview..
--armor
"list[detached:"..player_name.."_armor;armor;0,0;1,1;1]"..
"list[detached:"..player_name.."_armor;armor;0,1;1,1;2]"..