From 0a4781438301a558a45d54c8c636ad6ef5df9199 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 3 Sep 2023 20:44:57 +0200 Subject: [PATCH] Fix placing fishbuckets to actually replace buildable_to --- mods/ITEMS/mcl_buckets/fishbuckets.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/fishbuckets.lua b/mods/ITEMS/mcl_buckets/fishbuckets.lua index 80c988012..a96e679a6 100644 --- a/mods/ITEMS/mcl_buckets/fishbuckets.lua +++ b/mods/ITEMS/mcl_buckets/fishbuckets.lua @@ -18,14 +18,21 @@ local function on_place_fish(itemstack, placer, pointed_thing) return new_stack end - local pos = pointed_thing.above or pointed_thing.under - if not pos then return end - local n = minetest.get_node_or_nil(pos) - local def = minetest.registered_nodes[n.name] - if def and def.buildable_to or n.name == "mcl_portals:portal" then - local fish = itemstack:get_name():gsub(fishbucket_prefix,"") - if fish_names[fish] then - local o = minetest.add_entity(pos, "mobs_mc:" .. fish) + if pointed_thing.type ~= "node" then return end + + local pos = pointed_thing.above + local n = minetest.get_node(pointed_thing.above) + local def = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name] + + if ( def and def.buildable_to ) or n.name == "mcl_portals:portal" then + pos = pointed_thing.under + n = minetest.get_node(pointed_thing.under) + end + + local fish = itemstack:get_name():gsub(fishbucket_prefix,"") + if fish_names[fish] then + local o = minetest.add_entity(pos, "mobs_mc:" .. fish) + if o and o:get_pos() then local props = itemstack:get_meta():get_string("properties") if props ~= "" then o:set_properties(minetest.deserialize(props))