diff --git a/mailbox.lua b/mailbox.lua index a0f0528..dbfd09e 100644 --- a/mailbox.lua +++ b/mailbox.lua @@ -2,11 +2,13 @@ local mailbox = {} screwdriver = screwdriver or {} local function img_col(stack) - if not stack then return "" end - if stack.inventory_image ~= "" then - return stack.inventory_image:match("(.*)%.png")..".png" + local def = minetest.registered_items[stack] + if not def then return "" end + + if def.inventory_image ~= "" then + return def.inventory_image:match("(.*)%.png")..".png" else - return stack.tiles[1]:match("(.*)%.png")..".png" + return def.tiles[1]:match("(.*)%.png")..".png" end end @@ -23,7 +25,9 @@ function mailbox:formspec(pos, owner, num) local stack_count = meta:get_string("stack"..i):match("%s(%d+)") or 1 giver = giver.."#FFFF00,"..giver_name..","..i..",#FFFFFF,x "..stack_count.."," - img = img..i.."="..img_col(minetest.registered_items[stack_name]).."," + -- Hack to force using a 16px resolution for images in formspec's tablecolumn. + -- The engine doesn't scale them automatically yet. + img = img..i.."=mailbox_blank16.png^"..img_col(stack_name).."," end end diff --git a/textures/mailbox_blank16.png b/textures/mailbox_blank16.png new file mode 100644 index 0000000..849e622 Binary files /dev/null and b/textures/mailbox_blank16.png differ