From d6a404ce92eee770a4cf44c57501c89a98bdd88a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 13 Feb 2017 19:06:12 +0100 Subject: [PATCH] Add container group for nodes with inventories --- API.md | 5 +++++ mods/mcl_chests/init.lua | 10 ++++++---- mods/mcl_furnaces/init.lua | 4 ++-- mods/mcl_hoppers/init.lua | 4 ++-- mods/redstone/mcl_dropper/init.lua | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/API.md b/API.md index 143775d2b5..ec2bcc645b 100644 --- a/API.md +++ b/API.md @@ -86,6 +86,11 @@ These groups are used mostly for informational purposes * `eatable`: Item can be *directly* eaten by wielding + left click (`on_use=item_eat`). Rating is the satiation gain * `ammo=1`: Item is used as ammo for a weapon * `ammo_bow=1`: Item is used as ammo for bows +* `container`: Node is a container which physically stores items within and has at least 1 inventory + * `container=2`: Has one inventory with list name `"main"`. Items can be placed and taken freely + * `container=3`: Same as `container=2`, but shulker boxes can not be inserted + * `container=4`: Furnace-like, has lists `"src"`, `"fuel"` and `"dst"` + * `container=1`: Other/unspecified container type * `weapon=1`: Item is primarily (!) a weapon * `tool=1`: Item is primarily (!) a tool diff --git a/mods/mcl_chests/init.lua b/mods/mcl_chests/init.lua index 83b3b7a261..d89ce7101b 100644 --- a/mods/mcl_chests/init.lua +++ b/mods/mcl_chests/init.lua @@ -28,7 +28,7 @@ minetest.register_node("mcl_chests:chest", { "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, paramtype2 = "facedir", stack_max = 64, - groups = {choppy=2,oddly_breakable_by_hand=2, deco_block=1}, + groups = {choppy=2,container=2,oddly_breakable_by_hand=2, deco_block=1}, is_ground_content = false, sounds = mcl_sounds.node_sound_wood_defaults(), on_construct = function(pos) @@ -139,7 +139,7 @@ minetest.register_node("mcl_chests:chest_left", { tiles = {"default_chest_top_big.png", "default_chest_top_big.png", "default_chest_side.png", "default_chest_side.png", "default_chest_side_big.png^[transformFX", "default_chest_front_big.png"}, paramtype2 = "facedir", - groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + groups = {choppy=2,container=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, drop = "mcl_chests:chest", is_ground_content = false, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -198,7 +198,7 @@ minetest.register_node("mcl_chests:chest_right", { tiles = {"default_chest_top_big.png^[transformFX", "default_chest_top_big.png^[transformFX", "default_chest_side.png", "default_chest_side.png", "default_chest_side_big.png", "default_chest_front_big.png^[transformFX"}, paramtype2 = "facedir", - groups = {choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + groups = {choppy=2,container=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, drop = "mcl_chests:chest", is_ground_content = false, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -273,6 +273,8 @@ minetest.register_node("mcl_chests:ender_chest", { tiles = {"mcl_chests_ender_chest_top.png", "mcl_chests_ender_chest_bottom.png", "mcl_chests_ender_chest_right.png", "mcl_chests_ender_chest_left.png", "mcl_chests_ender_chest_back.png", "mcl_chests_ender_chest_front.png"}, + -- Note: The “container” group is missing here because the ender chest does not + -- have an inventory on its own groups = {cracky=1, deco_block=1}, is_ground_content = false, paramtype = "light", @@ -335,7 +337,7 @@ for color, desc in pairs(boxtypes) do tiles = {"mcl_chests_"..color.."_shulker_box_top.png", "mcl_chests_"..color.."_shulker_box_bottom.png", "mcl_chests_"..color.."_shulker_box_side.png", "mcl_chests_"..color.."_shulker_box_side.png", "mcl_chests_"..color.."_shulker_box_side.png", "mcl_chests_"..color.."_shulker_box_side.png"}, - groups = {cracky=2, deco_block=1, shulker_box=1}, + groups = {cracky=2, container=3, deco_block=1, shulker_box=1}, is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(), stack_max = 1, diff --git a/mods/mcl_furnaces/init.lua b/mods/mcl_furnaces/init.lua index c2d384c7ce..2e98dd1e40 100644 --- a/mods/mcl_furnaces/init.lua +++ b/mods/mcl_furnaces/init.lua @@ -30,7 +30,7 @@ minetest.register_node("mcl_furnaces:furnace", { paramtype2 = "facedir", is_ground_content = false, stack_max = 64, - groups = {cracky=2, deco_block=1}, + groups = {cracky=2, container=4, deco_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -96,7 +96,7 @@ minetest.register_node("mcl_furnaces:furnace_active", { is_ground_content = false, light_source = 13, drop = "mcl_furnaces:furnace", - groups = {cracky=2, not_in_creative_inventory=1}, + groups = {cracky=2, container=4, not_in_creative_inventory=1}, sounds = mcl_sounds.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/mods/mcl_hoppers/init.lua b/mods/mcl_hoppers/init.lua index 0ce0ecc14a..1571f7f633 100644 --- a/mods/mcl_hoppers/init.lua +++ b/mods/mcl_hoppers/init.lua @@ -15,7 +15,7 @@ local mcl_hoppers_formspec = minetest.register_node("mcl_hoppers:hopper", { drop = "mcl_hoppers:hopper_item", description = "Hopper (Node)", - groups = {cracky=1,level=2,not_in_creative_inventory=1}, + groups = {cracky=1,level=2,container=2,not_in_creative_inventory=1}, drawtype = "nodebox", paramtype = "light", tiles = {"mcl_hoppers_hopper_inside.png^mcl_hoppers_hopper_top.png", "mcl_hoppers_hopper_outside.png", "mcl_hoppers_hopper_outside.png", "mcl_hoppers_hopper_inside.png", "mcl_hoppers_hopper_outside.png", "mcl_hoppers_hopper_outside.png"}, @@ -74,7 +74,7 @@ minetest.register_node("mcl_hoppers:hopper", { minetest.register_node("mcl_hoppers:hopper_side", { description = "Hopper (Side)", drop = "mcl_hoppers:hopper_item", - groups = {cracky=1,level=2,not_in_creative_inventory=1}, + groups = {cracky=1,level=2,container=2,not_in_creative_inventory=1}, drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", diff --git a/mods/redstone/mcl_dropper/init.lua b/mods/redstone/mcl_dropper/init.lua index 54a8cddeb1..9b3625220f 100644 --- a/mods/redstone/mcl_dropper/init.lua +++ b/mods/redstone/mcl_dropper/init.lua @@ -5,7 +5,7 @@ minetest.register_node("mcl_dropper:dropper", { "default_furnace_side.png", "default_furnace_side.png", "default_furnace_side.png", "mcl_dropper_dropper_front_horizontal.png" }, - groups = {cracky=2}, + groups = {cracky=2,container=2}, is_ground_content = false, paramtype2 = "facedir", sounds = mcl_sounds.node_sound_stone_defaults(),