From 19907bd15a70b6cac1cb758e33e3bfcfc66efb29 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Mon, 3 Apr 2023 19:32:29 +0200 Subject: [PATCH] creative: Fix poor UX if no items to show --- mods/creative/inventory.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua index 1f9a1d50..3826d9be 100644 --- a/mods/creative/inventory.lua +++ b/mods/creative/inventory.lua @@ -150,9 +150,10 @@ function creative.register_tab(name, title, items) creative.update_creative_inventory(player_name, items) local inv = player_inventory[player_name] local pagenum = math.floor(inv.start_i / (4*8) + 1) - local pagemax = math.ceil(inv.size / (4*8)) + local pagemax = math.max(math.ceil(inv.size / (4*8)), 1) local esc = minetest.formspec_escape return sfinv.make_formspec(player, context, + (inv.size == 0 and ("label[3,2;"..esc(S("No items to show.")).."]") or "") .. "label[5.8,4.15;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. [[ image[4.08,4.2;0.8,0.8;creative_trash_icon.png]