From 3deb0213a3cf4b936dc555227149a4b595282a29 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 17 Jan 2017 18:17:53 +0100 Subject: [PATCH] Add Minecraft-style hopper inventory --- mods/hopper/init.lua | 28 ++++++++++------------ mods/hopper/textures/hopper_inventory.png | Bin 0 -> 4853 bytes 2 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 mods/hopper/textures/hopper_inventory.png diff --git a/mods/hopper/init.lua b/mods/hopper/init.lua index 0dcb40b34b..23a8c4a53e 100644 --- a/mods/hopper/init.lua +++ b/mods/hopper/init.lua @@ -2,15 +2,15 @@ local chest = minetest.get_content_id("default:chest") -local chest_formspec = - "size[8,9]".. - --default.gui_bg.. - --default.gui_bg_img.. - --default.gui_slots.. - "list[current_name;main;0,0.3;8,4;]".. - "list[current_player;main;0,4.85;8,1;]".. - "list[current_player;main;0,6.08;8,3;8]" - --default.get_hotbar_bg(0,4.85) +local hopper_formspec = + "size[9,7]".. + "background[-0.19,-0.25;9.41,10.48;hopper_inventory.png]".. + default.inventory_header.. + "list[current_name;main;2,0.5;5,1;]".. + "list[current_player;main;0,2.5;9,3;9]".. + "list[current_player;main;0,5.74;9,1;]".. + "listring[current_name;main]".. + "listring[current_player;main]" minetest.register_node("hopper:hopper", { drop = "hopper:hopper_item", @@ -38,10 +38,9 @@ minetest.register_node("hopper:hopper", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", chest_formspec) - meta:set_string("infotext", "Chest") + meta:set_string("formspec", hopper_formspec) local inv = meta:get_inventory() - inv:set_size("main", 8*4) + inv:set_size("main", 5) end, can_dig = function(pos,player) local meta = minetest.get_meta(pos); @@ -90,10 +89,9 @@ minetest.register_node("hopper:hopper_side", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", chest_formspec) - meta:set_string("infotext", "Chest") + meta:set_string("formspec", hopper_formspec) local inv = meta:get_inventory() - inv:set_size("main", 8*4) + inv:set_size("main", 5) end, can_dig = function(pos,player) local meta = minetest.get_meta(pos); diff --git a/mods/hopper/textures/hopper_inventory.png b/mods/hopper/textures/hopper_inventory.png new file mode 100644 index 0000000000000000000000000000000000000000..f44510466f4d25216cd07d0d4385e07e97491d82 GIT binary patch literal 4853 zcmeHKYfw{16y6AmC_W-O+A7#VD}~mgMF(t95JMw$WNa!rs1>kPP^1I`i6DWDV<}(@ zZKaG-&;kNhgkUkCMII_6j$&v^kw*!U1dS4th?s;&61q1Gix)x~es+e;X71zc{m$9% zob%ni$vb^1^X9xg2LLe7dpns5fSE7+e>r;=yp#Qt&k=Ya(5VzpP{LdB9A3;i_$h@9 zhT$1-wvX$B2TR&^e>wnj7h!+GUxIiIylD~Ty~E3*i$EmKU;c3J?q>ijiuNXN-F3WO zCfG_9f3hsGD%AtsS1kXUFXA&y=o0s!_-1tpcS!ZRT=0Ju&SH3{!abzy7xaNz0j>z2s7Y)UM`vJ?-mj3v=#t%*;&azPwyFjh?}7lRyBEB15j&W4;K$^TLR$W z3SG>$hgV(j$#=5g$tgI4O@rPRVv~&75P<%<_>%D6)f^6|Xp8R2lS9ptB9>c)piu`v z*7w#p2aM+K)TS2FI{7__PZ8C<83y|cC8ggklw-zK@&4}Qyze)pRWs^CWws|0bj2Jo zS2e^R>|4oN3E0k&qBkS1Etwxte?)4NQ_M_xq|0D>Qn zcNMJJrqKT3b&adG$*OW6?sQKJt%+x50#LFkVw3=Ek%4;(Z;GQ7oHKPFhbm?Z2BVA0 z6mTkf&L) zW5J|<+IS0YI%g&0Glnk-oS$*!g14cX(wEXCHU$2kwTJ)=)G4x|f*q^ji8cgaS`%OZ zlQjq)94+R0PN#Y40iWlhwTyCSI9|49VL99tMf}XiVX2~F(>|y?uK6+NIkqIM)-IVu z(G*(}MKcMwNfhZPnUovTDe~|Wio6d51ngmH9y~a$Xs{U?)V|iv0FU|O8*hi)l~rXX zPPGDnw%Qk`Ppy6lr<@{XQV*72y%Wk%hO03)0BM#P%Ea7)1}Ogh|2=Yw%Fijk5tu7*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