Extra checks placed in.

This commit is contained in:
Michieal 2023-09-26 18:35:12 +00:00
parent b2ebcf5d4f
commit eafe6627d8
1 changed files with 11 additions and 3 deletions

View File

@ -86,7 +86,12 @@ local bamboo_def = {
on_rotate = on_rotate,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing and pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node.
if not pointed_thing then
return itemstack
end
if pointed_thing.type ~= "node" then
return itemstack
end
local node = minetest.get_node(pointed_thing.under)
@ -276,8 +281,11 @@ local bamboo_block_def = {
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_bamboo:bamboo_block_stripped", -- this allows us to use the built in Axe's strip block.
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing then
return itemstack
end
if not pointed_thing then -- make sure that pointed_thing is not null
if pointed_thing.type ~= "node" then -- make sure that pointed_thing is not null and is pointing at a node.
return itemstack
end