Merge pull request 'The Pull Request that Fixed the Creative Inventory' (#4237) from creative_inv_fixes into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4237
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
This commit is contained in:
the-real-herowl 2024-04-27 06:19:11 +00:00
commit 3bcbb99878

@ -204,7 +204,8 @@ local function init(player)
local playername = player:get_player_name() local playername = player:get_player_name()
minetest.create_detached_inventory("creative_" .. playername, { minetest.create_detached_inventory("creative_" .. playername, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.is_creative_enabled(playername) then if minetest.is_creative_enabled(playername) and
from_list ~= to_list then
return count return count
else else
return 0 return 0
@ -541,7 +542,6 @@ function mcl_inventory.set_creative_formspec(player)
"style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]", "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]",
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]", "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]",
"item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]",
"tooltip[blocks;" .. F(filtername[this_tab]) .. "]"
}) })
end end
@ -570,20 +570,33 @@ function mcl_inventory.set_creative_formspec(player)
listrings, listrings,
tab(name, "blocks"), tab(name, "blocks") ..
tab(name, "deco"), "tooltip[blocks;"..F(filtername["blocks"]).."]"..
tab(name, "redstone"), tab(name, "deco") ..
tab(name, "rail"), "tooltip[deco;"..F(filtername["deco"]).."]"..
tab(name, "misc"), tab(name, "redstone") ..
tab(name, "nix"), "tooltip[redstone;"..F(filtername["redstone"]).."]"..
tab(name, "rail") ..
"tooltip[rail;"..F(filtername["rail"]).."]"..
tab(name, "misc") ..
"tooltip[misc;"..F(filtername["misc"]).."]"..
tab(name, "nix") ..
"tooltip[nix;"..F(filtername["nix"]).."]"..
tab(name, "food"), tab(name, "food") ..
tab(name, "tools"), "tooltip[food;"..F(filtername["food"]).."]"..
tab(name, "combat"), tab(name, "tools") ..
tab(name, "mobs"), "tooltip[tools;"..F(filtername["tools"]).."]"..
tab(name, "brew"), tab(name, "combat") ..
tab(name, "matr"), "tooltip[combat;"..F(filtername["combat"]).."]"..
tab(name, "inv"), tab(name, "mobs") ..
"tooltip[mobs;"..F(filtername["mobs"]).."]"..
tab(name, "brew") ..
"tooltip[brew;"..F(filtername["brew"]).."]"..
tab(name, "matr") ..
"tooltip[matr;"..F(filtername["matr"]).."]"..
tab(name, "inv") ..
"tooltip[inv;"..F(filtername["inv"]).."]"
}) })
if name == "nix" then if name == "nix" then
@ -594,6 +607,7 @@ function mcl_inventory.set_creative_formspec(player)
formspec = formspec .. table.concat({ formspec = formspec .. table.concat({
"field[5.325,0.15;6.1,0.6;search;;" .. minetest.formspec_escape(filter) .. "]", "field[5.325,0.15;6.1,0.6;search;;" .. minetest.formspec_escape(filter) .. "]",
"field_close_on_enter[search;false]", "field_close_on_enter[search;false]",
"field_enter_after_edit[search;true]",
"set_focus[search;true]", "set_focus[search;true]",
}) })
end end