From 5515e2baa169ee3e5e2fe55043f8fe3272a5269a Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 12 Nov 2021 21:49:47 +0000 Subject: [PATCH 1/7] Add 64 items to inventory when creative is on --- mods/HUD/mcl_inventory/creative.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 2be0be4bc..43301ce0b 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -667,3 +667,9 @@ minetest.register_on_joinplayer(function(player) init(player) mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "") end) + +minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) + if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" then + player:get_inventory():set_stack("main", inventory_info.index, inventory_info.stack:get_name() .. " 64") + end +end) From ae8068cca671f5e215045fa4227e05b21fe5ebc5 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 13 Nov 2021 11:17:46 +0000 Subject: [PATCH 2/7] Use stack_max instead of 64 for all items --- mods/HUD/mcl_inventory/creative.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 43301ce0b..4f9f1685a 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -670,6 +670,7 @@ end) minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" then - player:get_inventory():set_stack("main", inventory_info.index, inventory_info.stack:get_name() .. " 64") + local stack = inventory_info.stack + player:get_inventory():set_stack("main", inventory_info.index, stack:get_name() .. " " .. stack:get_stack_max()) end -end) +end) \ No newline at end of file From d4da8555708f2db411cbd0352cc4d7e62b7ee99d Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 13 Nov 2021 12:25:10 +0000 Subject: [PATCH 3/7] Add button to switch between max stack size and just one item --- mods/HUD/mcl_inventory/creative.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 4f9f1685a..de03886d9 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -289,6 +289,17 @@ filtername["inv"] = S("Survival Inventory") bg["default"] = dark_bg end]] +local function get_stack_size(player) + return player:get_meta():get_int("switch_stack") +end + +local function set_stack_size(player, n) + player:get_meta():set_int("switch_stack", n) +end + +minetest.register_on_newplayer(function (player) + set_stack_size(player, 64) +end) function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter) --reset_menu_item_bg() @@ -349,6 +360,11 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]" end + local switch_overlay = "blank.png" + if get_stack_size(player) == 64 then + switch_overlay = "mcl_inventory_button_switch_stack.png" + end + -- Survival inventory slots main_list = "list[current_player;main;0,3.75;9,3;9]".. mcl_formspec.get_itemslot_bg(0,3.75,9,3).. @@ -376,7 +392,10 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, -- achievements button "image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]".. --"style_type[image_button;border=;bgimg=;bgimg_pressed=]".. - "tooltip[__mcl_achievements;"..F(S("Achievements")).."]" + "tooltip[__mcl_achievements;"..F(S("Achievements")).."]".. + -- switch stack size button + "image_button[9,5;1,1;default_apple.png^" .. switch_overlay .. ";__switch_stack;]".. + "tooltip[__switch_stack;"..F(S("Switch stack size")).."]" -- For shortcuts listrings = listrings .. @@ -544,6 +563,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) elseif fields.search and not fields.creative_next and not fields.creative_prev then set_inv_search(string.lower(fields.search),player) page = "nix" + elseif fields.__switch_stack then + local switch = 1 + if get_stack_size(player) == 1 then + switch = 64 + end + set_stack_size(player, switch) end if page then @@ -669,7 +694,7 @@ minetest.register_on_joinplayer(function(player) end) minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info) - if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" then + if minetest.is_creative_enabled(player:get_player_name()) and action == "put" and inventory_info.listname == "main" and get_stack_size(player) == 64 then local stack = inventory_info.stack player:get_inventory():set_stack("main", inventory_info.index, stack:get_name() .. " " .. stack:get_stack_max()) end From d7e59f6a359c2bb371e63829b51f74ae685735ab Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 13 Nov 2021 12:26:01 +0000 Subject: [PATCH 4/7] Add switch stack size overlay texture --- .../mcl_inventory_button_switch_stack.png | Bin 0 -> 8936 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png diff --git a/mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png b/mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png new file mode 100644 index 0000000000000000000000000000000000000000..ac56d833d0c6c4efcb9633794ffc9d767247d962 GIT binary patch literal 8936 zcmVP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*rmgF{;h5us}vjoBe%fW*=XLc~lpYMW^sghLc zE~#6o%7~-|pScF0+yD2!$NdlgmDqwyxwg_vdH65&)WhIQd*1*0{q3K0f8YP&`t0++ z-|oJ51U5w-`TkkQ=lH?){M!j%_we@n?XG?Hg!Z}6XUEqCqwXB|vVI&S+rzuvr_Y7@ ze!rC7>W@RU@P5wEfp;jMf3e<6e_up@yB{~CN|aXSs2IYIK0fz%dq)uU&&R>P_cw#m zZ@#m~-A(l~5(4tO$NTzxo*x7ByC8pkbAOEf_qRU;Ka9`z_=i}QPmK8T(;YtlJoq=n z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PBQI-R$ct`;C*!<>cbxVtk;Q{dfKJ z=VrwhHTyqroQa7EwYa#bkdW}DS Date: Sat, 13 Nov 2021 17:26:17 +0000 Subject: [PATCH 5/7] Use label instead of extra texture --- mods/HUD/mcl_inventory/creative.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index de03886d9..a3314ec0a 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -1,5 +1,6 @@ local S = minetest.get_translator(minetest.get_current_modname()) local F = minetest.formspec_escape +local C = minetest.colorize -- Prepare player info table local players = {} @@ -360,11 +361,8 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]" end - local switch_overlay = "blank.png" - if get_stack_size(player) == 64 then - switch_overlay = "mcl_inventory_button_switch_stack.png" - end - + local stack_size = get_stack_size(player) + -- Survival inventory slots main_list = "list[current_player;main;0,3.75;9,3;9]".. mcl_formspec.get_itemslot_bg(0,3.75,9,3).. @@ -394,8 +392,9 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, --"style_type[image_button;border=;bgimg=;bgimg_pressed=]".. "tooltip[__mcl_achievements;"..F(S("Achievements")).."]".. -- switch stack size button - "image_button[9,5;1,1;default_apple.png^" .. switch_overlay .. ";__switch_stack;]".. - "tooltip[__switch_stack;"..F(S("Switch stack size")).."]" + "image_button[9,5;1,1;default_apple.png;__switch_stack;]".. + "label[9.4,5.4;".. F(C("#FFFFFF", stack_size ~= 1 and stack_size or "")) .."]".. + "tooltip[__switch_stack;"..F(S("Switch stack size")).."]" -- For shortcuts listrings = listrings .. From add97d39a6171ee5bc20c829dc98074d37fcc14f Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 13 Nov 2021 17:28:13 +0000 Subject: [PATCH 6/7] delete overlay texture --- .../mcl_inventory_button_switch_stack.png | Bin 8936 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png diff --git a/mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png b/mods/HUD/mcl_inventory/textures/mcl_inventory_button_switch_stack.png deleted file mode 100644 index ac56d833d0c6c4efcb9633794ffc9d767247d962..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8936 zcmVP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3*rmgF{;h5us}vjoBe%fW*=XLc~lpYMW^sghLc zE~#6o%7~-|pScF0+yD2!$NdlgmDqwyxwg_vdH65&)WhIQd*1*0{q3K0f8YP&`t0++ z-|oJ51U5w-`TkkQ=lH?){M!j%_we@n?XG?Hg!Z}6XUEqCqwXB|vVI&S+rzuvr_Y7@ ze!rC7>W@RU@P5wEfp;jMf3e<6e_up@yB{~CN|aXSs2IYIK0fz%dq)uU&&R>P_cw#m zZ@#m~-A(l~5(4tO$NTzxo*x7ByC8pkbAOEf_qRU;Ka9`z_=i}QPmK8T(;YtlJoq=n zKbFJyh{Er8So8HykMsF=&T8lE_vuC|M6`S=>TzGu(K#GwggoBU3O|*9neX-fbbi`1 zo=I}nGaut;`tAc+InF1){P4%``#Jq&h$-w)`3zx_C~a%8h8|{Ao|1n22{rb(Vk4I` zY)AT14Bun%_rCq!Z~Dfam*>#nxtQmazx;9kYUkhiapz2h$Up5nR*WmCav6p)r{5e! zLj3vUE#Clt{e05@{7^rXDjCc-%#8;ekG+?$?0>7Rc=H@NF7x?zg?Dv*E4LOvc&0rIW$g#vq zZh9OfE2T{R)YPbY-g@t21UISH?(T+CJptzjOCn=6)$} zF1KIGTljaGb4uNRBXf?_{W)(x$=VXn&6}~e3l-BR(tXQDXu}0tT&EcQr$5X zTRvrtnZ0B`h5B4pLGZ?-OPE{n0H%GJy6F}`>Cr3Ld0-(I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ic6Jtn!Jr_e{2CECBe#{wWXQ5C zL{Wqw2+-|zQLR?tc^(FX!QS;*W@ctkEEe&=0}r6xZsXFWOQRIue;ew$E)2s!DwRSm zmxJedV-G#_(8H!_{v@4FZ#s^Hv9YlQUDwfUHqmG_5Jiz}x7&Zyb$z+jYGHeO8#_BY zBTGs|L{n2!-%?6F5yvrn-^c3eDjdi8`{d;0Uk-xkm~-Blnwsj&%*>>-*{oA679R}5 z@IfI2G);qH7|=8gtE;Q1R4ULkO|Gr2{c&z??hl1R0h5!Hqhll670ybf(yvX^d}34< zVHl#(X#Dx&#fz`+w`dhbQHL@1yI!wXU0GTAsbLt03WWk}+uo~n&-38AF0Ng>hMPBU zBA?IidFs2))DdHhh)4+`)X0L47D2->m|+-v-y_}WbbJ6;f*=499m!_1Pe>_`#&JB_ zp0KsGg=)2mN~Hqd_czAI#;y|4CII!)OE2BsG6I0u_x+xf@{a4ej_bNw9LIY;d|yTH z_PA8JTxM|`f4~@fd3kyHmq8F*=yW>pJa2EM1^~;lVB7X(#@Np_P3zrn?9I*1rj&BM z)9D;-Hk+9+3?ZeA0YnF-8>)J}o)2K?dEQ%L7`nS1Q24$N&iP0%gb?qQN~PBQI-R$ct`;C*!<>cbxVtk;Q{dfKJ z=VrwhHTyqroQa7EwYa#bkdW}DS Date: Sat, 13 Nov 2021 18:56:52 +0000 Subject: [PATCH 7/7] Use on_joinplayer instead of on_newplayer --- mods/HUD/mcl_inventory/creative.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index a3314ec0a..d2dedd556 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -291,15 +291,17 @@ filtername["inv"] = S("Survival Inventory") end]] local function get_stack_size(player) - return player:get_meta():get_int("switch_stack") + return player:get_meta():get_int("mcl_inventory:switch_stack") end local function set_stack_size(player, n) - player:get_meta():set_int("switch_stack", n) + player:get_meta():set_int("mcl_inventory:switch_stack", n) end -minetest.register_on_newplayer(function (player) - set_stack_size(player, 64) +minetest.register_on_joinplayer(function (player) + if get_stack_size(player) == 0 then + set_stack_size(player, 64) + end end) function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter)