Fix bonemeal creative for sweet berries and nether vines

This commit is contained in:
cora 2022-11-29 12:19:27 +01:00
parent 34a558ced9
commit d395c82183
2 changed files with 15 additions and 7 deletions

@ -118,15 +118,19 @@ minetest.register_node("mcl_crimson:twisting_vines", {
node_placement_prediction = "",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local pn = clicker:get_player_name()
if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn) then
if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then
minetest.record_protection_violation(vector.offset(pos,0,1,0), pn)
return itemstack
end
if clicker:get_wielded_item():get_name() == "mcl_crimson:twisting_vines" then
itemstack:take_item()
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
grow_vines(pos, 1, "mcl_crimson:twisting_vines")
elseif clicker:get_wielded_item():get_name() == "mcl_dye:white" then
itemstack:take_item()
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
grow_vines(pos, math.random(1, 3),"mcl_crimson:twisting_vines")
end
return itemstack
@ -170,15 +174,19 @@ minetest.register_node("mcl_crimson:weeping_vines", {
node_placement_prediction = "",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local pn = clicker:get_player_name()
if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn) then
if clicker:is_player() and minetest.is_protected(vector.offset(pos,0,1,0), pn or "") then
minetest.record_protection_violation(vector.offset(pos,0,1,0), pn)
return itemstack
end
if clicker:get_wielded_item():get_name() == "mcl_crimson:weeping_vines" then
itemstack:take_item()
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
grow_vines(pos, 1, "mcl_crimson:weeping_vines", -1)
elseif clicker:get_wielded_item():get_name() == "mcl_dye:white" then
itemstack:take_item()
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
grow_vines(pos, math.random(1, 3),"mcl_crimson:weeping_vines", -1)
end
return itemstack

@ -72,7 +72,7 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
on_secondary_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
local pn = placer:get_player_name()
if placer:is_player() and minetest.is_protected(pointed_thing.above, pn) then
if placer:is_player() and minetest.is_protected(pointed_thing.above, pn or "") then
minetest.record_protection_violation(pointed_thing.above, pn)
return itemstack
end