From b1e0864cf195d65142ef361fc287c09eaa8f2667 Mon Sep 17 00:00:00 2001 From: red-001 Date: Thu, 19 May 2016 19:40:13 +0100 Subject: [PATCH] Creative: Reset 'start_i' to 1 when the inventory filter is changed --- mods/creative/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/creative/init.lua b/mods/creative/init.lua index bc4687f..0f5bd36 100644 --- a/mods/creative/init.lua +++ b/mods/creative/init.lua @@ -178,6 +178,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) elseif fields.creative_tabs then local tab = tonumber(fields.creative_tabs) inv.tab_id = tab + player_inventory[player_name].start_i = 1 if tab == 1 then creative.set_crafting_formspec(player) @@ -186,10 +187,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) creative.set_creative_formspec(player, 0) end elseif fields.creative_clear then + player_inventory[player_name].start_i = 1 inv.filter = "" creative.update_creative_inventory(player_name) creative.set_creative_formspec(player, 0) elseif fields.creative_search then + player_inventory[player_name].start_i = 1 inv.filter = fields.creative_filter:lower() creative.update_creative_inventory(player_name) creative.set_creative_formspec(player, 0)