Add Minecraft-style hopper inventory
parent
570d867157
commit
3deb0213a3
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
local chest = minetest.get_content_id("default:chest")
|
local chest = minetest.get_content_id("default:chest")
|
||||||
|
|
||||||
local chest_formspec =
|
local hopper_formspec =
|
||||||
"size[8,9]"..
|
"size[9,7]"..
|
||||||
--default.gui_bg..
|
"background[-0.19,-0.25;9.41,10.48;hopper_inventory.png]"..
|
||||||
--default.gui_bg_img..
|
default.inventory_header..
|
||||||
--default.gui_slots..
|
"list[current_name;main;2,0.5;5,1;]"..
|
||||||
"list[current_name;main;0,0.3;8,4;]"..
|
"list[current_player;main;0,2.5;9,3;9]"..
|
||||||
"list[current_player;main;0,4.85;8,1;]"..
|
"list[current_player;main;0,5.74;9,1;]"..
|
||||||
"list[current_player;main;0,6.08;8,3;8]"
|
"listring[current_name;main]"..
|
||||||
--default.get_hotbar_bg(0,4.85)
|
"listring[current_player;main]"
|
||||||
|
|
||||||
minetest.register_node("hopper:hopper", {
|
minetest.register_node("hopper:hopper", {
|
||||||
drop = "hopper:hopper_item",
|
drop = "hopper:hopper_item",
|
||||||
|
@ -38,10 +38,9 @@ minetest.register_node("hopper:hopper", {
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", chest_formspec)
|
meta:set_string("formspec", hopper_formspec)
|
||||||
meta:set_string("infotext", "Chest")
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 5)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
|
@ -90,10 +89,9 @@ minetest.register_node("hopper:hopper_side", {
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", chest_formspec)
|
meta:set_string("formspec", hopper_formspec)
|
||||||
meta:set_string("infotext", "Chest")
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8*4)
|
inv:set_size("main", 5)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Loading…
Reference in New Issue