From 250be40ecd1c736c18f5428094561cd74dff4177 Mon Sep 17 00:00:00 2001 From: kilbith Date: Sun, 17 Jan 2016 17:31:59 +0100 Subject: [PATCH] Fix blank page in creative in some rare case and keep crafting tab's size stationary --- mods/creative/init.lua | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mods/creative/init.lua b/mods/creative/init.lua index b02422fa..0659a202 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -42,7 +42,7 @@ creative_inventory.init_creative_inventory = function(player) }) creative_inventory.update(player_name, nil, 2) - --print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) + --print("creative inventory size: "..dump(creative_inventory[player_name].size)) end local function tab_category(tab_id) @@ -128,19 +128,19 @@ end creative_inventory.set_crafting_formspec = function(player) player:set_inventory_formspec([[ - size[8,7.5] - list[current_player;craft;2,0.25;3,3;] - list[current_player;craftpreview;6,1.25;1,1;] - list[current_player;main;0,3.6;8,1;] - list[current_player;main;0,4.75;8,3;8] - list[detached:creative_trash;main;0,2.25;1,1;] - image[0.06,2.35;0.8,0.8;trash_icon.png] - image[5,1.25;1,1;gui_furnace_arrow_bg.png^[transformR270] + size[8,8.6] + list[current_player;craft;2,0.75;3,3;] + list[current_player;craftpreview;6,1.75;1,1;] + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + list[detached:creative_trash;main;0,2.75;1,1;] + image[0.06,2.85;0.8,0.8;trash_icon.png] + image[5,1.75;1,1;gui_furnace_arrow_bg.png^[transformR270] tabheader[0,0;tabs;Crafting,All,Nodes,Tools,Items;1;true;false] listring[current_player;main] listring[current_player;craft] ]] .. - default.get_hotbar_bg(0,3.6).. + default.get_hotbar_bg(0,4.7).. default.gui_bg .. default.gui_bg_img .. default.gui_slots ) end @@ -191,6 +191,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) start_i = start_i - 3*8 if start_i < 0 then start_i = inv_size - (inv_size % (3*8)) + if inv_size == start_i then + start_i = math.max(0, inv_size - (3*8)) + end end elseif fields.creative_next then start_i = start_i + 3*8 -- 2.25.1