From 9aa1d1dac82d1c7eca1ec16c5344e1126103199d Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Mon, 1 May 2023 15:27:43 +0100 Subject: [PATCH] hoppers can now be placed in itemframes (thx Niklp) --- init.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 0265c03..dcdf92c 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ -- define global -hopper = {version = "20220331"} +hopper = {version = "20230501"} -- Intllib @@ -248,6 +248,17 @@ local hopper_place = function(itemstack, placer, pointed_thing) return itemstack end + if pointed_thing.type == "node" + and placer and not placer:get_player_control().sneak then + + local nn = minetest.get_node(pointed_thing.under).name + + if minetest.registered_nodes[nn] + and minetest.registered_nodes[nn].on_rightclick then + return minetest.item_place(itemstack, placer, pointed_thing) + end + end + if x == -1 then minetest.set_node(pos, {name = "hopper:hopper_side", param2 = 0}) @@ -478,6 +489,17 @@ minetest.register_node("hopper:hopper_void", { local pos = pointed_thing.above local name = placer:get_player_name() or "" + if pointed_thing.type == "node" + and placer and not placer:get_player_control().sneak then + + local nn = minetest.get_node(pointed_thing.under).name + + if minetest.registered_nodes[nn] + and minetest.registered_nodes[nn].on_rightclick then + return minetest.item_place(itemstack, placer, pointed_thing) + end + end + if not player_void[name] then minetest.chat_send_player(name, S("No container position set!")) return itemstack