From 73a22d3de1d081680c16bcbd54956f650a421ba2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 14 Feb 2017 01:37:30 +0100 Subject: [PATCH] Hopper doesn't check for item entities with container above --- mods/mcl_hoppers/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mods/mcl_hoppers/init.lua b/mods/mcl_hoppers/init.lua index e2b6ab3ab..61ee24ac7 100644 --- a/mods/mcl_hoppers/init.lua +++ b/mods/mcl_hoppers/init.lua @@ -130,13 +130,19 @@ minetest.register_node("mcl_hoppers:hopper_side", { end, sounds = mcl_sounds.node_sound_metal_defaults(), }) ---make mcl_hopperss suck in blocks + +-- Make hoppers suck in dropped items minetest.register_abm({ nodenames = {"mcl_hoppers:hopper","mcl_hoppers:hopper_side"}, interval = 1.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.get_meta(pos); + local abovenode = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) + -- Don't bother checking item enties if node above is a container (should save some CPU) + if minetest.registered_items[abovenode.name].groups.container then + return + end + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do