Compare commits

...

7 Commits
master ... fish

5 changed files with 26 additions and 14 deletions

View File

@ -18,13 +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)
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 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_definition()._mcl_buckets_fish
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))
@ -60,6 +68,7 @@ for techname, fishname in pairs(fish_names) do
stack_max = 1,
groups = {bucket = 1, fish_bucket = 1},
liquids_pointable = false,
_mcl_buckets_fish = techname,
on_place = on_place_fish,
on_secondary_use = on_place_fish,
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)

View File

@ -1581,7 +1581,7 @@ end
-- MUST NOT be called if there is a snow cover node above pos.
function mcl_core.clear_snow_dirt(pos, node)
local def = minetest.registered_nodes[node.name]
if def._mcl_snowless then
if def and def._mcl_snowless then
minetest.swap_node(pos, {name = def._mcl_snowless, param2=node.param2})
end
end
@ -1602,7 +1602,7 @@ function mcl_core.on_snowable_construct(pos)
-- Make snowed if needed
if minetest.get_item_group(anode.name, "snow_cover") == 1 then
local def = minetest.registered_nodes[node.name]
if def._mcl_snowed then
if def and def._mcl_snowed then
minetest.swap_node(pos, {name = def._mcl_snowed, param2=node.param2})
end
end
@ -1623,7 +1623,7 @@ function mcl_core.on_snow_construct(pos)
local npos = {x=pos.x, y=pos.y-1, z=pos.z}
local node = minetest.get_node(npos)
local def = minetest.registered_nodes[node.name]
if def._mcl_snowed then
if def and def._mcl_snowed then
minetest.swap_node(npos, {name = def._mcl_snowed, param2=node.param2})
end
end

View File

@ -1038,7 +1038,7 @@ for i=1,8 do
-- Get position where snow would be placed
local target
if minetest.registered_nodes[unode.name].buildable_to then
if def and def.buildable_to then
target = under
else
target = above

View File

@ -155,7 +155,8 @@ minetest.register_node("mcl_end:chorus_flower", {
1) On top of end stone or chorus plant
2) On top of air and horizontally adjacent to exactly 1 chorus plant ]]
local pos
if minetest.registered_nodes[node_under.name].buildable_to then
local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
pos = pointed_thing.under
else
pos = pointed_thing.above
@ -283,7 +284,8 @@ minetest.register_node("mcl_end:chorus_plant", {
condition is met:
- placed on end stone or any chorus node ]]
local pos_place, node_check
if minetest.registered_nodes[node_under.name].buildable_to then
local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
pos_place = pointed_thing.under
node_check = node_above
else

View File

@ -301,7 +301,8 @@ minetest.register_node("mcl_mobspawners:spawner", {
local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing)
if success then
local placepos
if minetest.registered_nodes[node_under.name].buildable_to then
local def = minetest.registered_nodes[node_under.name]
if def and def.buildable_to then
placepos = pointed_thing.under
else
placepos = pointed_thing.above