From 99db678a44dadd871f051d06904428483b6680e9 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 25 Nov 2022 03:21:35 +0100 Subject: [PATCH] Fish buckets set properties from bucket item meta --- mods/ITEMS/mcl_buckets/register.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_buckets/register.lua b/mods/ITEMS/mcl_buckets/register.lua index baea8ce3e..f2baaf7a5 100644 --- a/mods/ITEMS/mcl_buckets/register.lua +++ b/mods/ITEMS/mcl_buckets/register.lua @@ -131,12 +131,17 @@ local fish_names = { local fishbucket_prefix = "mcl_buckets:bucket_" local function on_place_fish(itemstack, placer, pointed_thing) - local pos = pointed_thing.above + local pos = pointed_thing.above or pointed_thing.under + if not pos then return end local n = minetest.get_node_or_nil(pos) - if n and minetest.registered_nodes[n.name].buildable_to or n.name == "mcl_portals:portal" then + if n.name and minetest.registered_nodes[n.name].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) + local props = itemstack:get_meta():get_string("properties") + if props ~= "" then + o:set_properties(minetest.deserialize(props)) + end minetest.set_node(pos,{name = "mcl_core:water_source"}) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:set_name("mcl_buckets:bucket_empty")