forked from VoxeLibre/VoxeLibre
Fix placing fishbuckets to actually replace buildable_to
This commit is contained in:
parent
12727a6a0a
commit
0a47814383
|
@ -18,14 +18,21 @@ local function on_place_fish(itemstack, placer, pointed_thing)
|
||||||
return new_stack
|
return new_stack
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = pointed_thing.above or pointed_thing.under
|
if pointed_thing.type ~= "node" then return end
|
||||||
if not pos then return end
|
|
||||||
local n = minetest.get_node_or_nil(pos)
|
local pos = pointed_thing.above
|
||||||
local def = minetest.registered_nodes[n.name]
|
local n = minetest.get_node(pointed_thing.above)
|
||||||
if def and def.buildable_to or n.name == "mcl_portals:portal" then
|
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,"")
|
local fish = itemstack:get_name():gsub(fishbucket_prefix,"")
|
||||||
if fish_names[fish] then
|
if fish_names[fish] then
|
||||||
local o = minetest.add_entity(pos, "mobs_mc:" .. fish)
|
local o = minetest.add_entity(pos, "mobs_mc:" .. fish)
|
||||||
|
if o and o:get_pos() then
|
||||||
local props = itemstack:get_meta():get_string("properties")
|
local props = itemstack:get_meta():get_string("properties")
|
||||||
if props ~= "" then
|
if props ~= "" then
|
||||||
o:set_properties(minetest.deserialize(props))
|
o:set_properties(minetest.deserialize(props))
|
||||||
|
|
Loading…
Reference in New Issue