1
0
Fork 0

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

View File

@ -118,15 +118,19 @@ minetest.register_node("mcl_crimson:twisting_vines", {
node_placement_prediction = "", node_placement_prediction = "",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local pn = clicker:get_player_name() 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) minetest.record_protection_violation(vector.offset(pos,0,1,0), pn)
return itemstack return itemstack
end end
if clicker:get_wielded_item():get_name() == "mcl_crimson:twisting_vines" then 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") grow_vines(pos, 1, "mcl_crimson:twisting_vines")
elseif clicker:get_wielded_item():get_name() == "mcl_dye:white" then 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") grow_vines(pos, math.random(1, 3),"mcl_crimson:twisting_vines")
end end
return itemstack return itemstack
@ -170,15 +174,19 @@ minetest.register_node("mcl_crimson:weeping_vines", {
node_placement_prediction = "", node_placement_prediction = "",
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local pn = clicker:get_player_name() 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) minetest.record_protection_violation(vector.offset(pos,0,1,0), pn)
return itemstack return itemstack
end end
if clicker:get_wielded_item():get_name() == "mcl_crimson:weeping_vines" then 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) grow_vines(pos, 1, "mcl_crimson:weeping_vines", -1)
elseif clicker:get_wielded_item():get_name() == "mcl_dye:white" then 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) grow_vines(pos, math.random(1, 3),"mcl_crimson:weeping_vines", -1)
end end
return itemstack return itemstack

View File

@ -72,7 +72,7 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
on_secondary_use = minetest.item_eat(1), on_secondary_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pn = placer:get_player_name() 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) minetest.record_protection_violation(pointed_thing.above, pn)
return itemstack return itemstack
end end