Beehives only go into inventory in creative when no beehive exists in the inventory

This commit is contained in:
PrairieWind 2023-02-22 20:09:35 -07:00 committed by Gitea
parent c71aec6f9d
commit 2f10a8767b

View file

@ -54,18 +54,20 @@ local dig_hive = function(pos, node, oldmetadata, digger)
if not is_creative then if not is_creative then
minetest.add_item(pos, "mcl_beehives:beehive") minetest.add_item(pos, "mcl_beehives:beehive")
if not silk_touch then mcl_util.deal_damage(digger, 10) end if not silk_touch then mcl_util.deal_damage(digger, 10) end
elseif is_creative and inv:room_for_item("main", "mcl_beehives:beehive") then elseif is_creative and inv:room_for_item("main", "mcl_beehives:beehive") and not inv:contains_item("main", "mcl_beehives:beehive") then
inv:add_item("main", "mcl_beehives:beehive") inv:add_item("main", "mcl_beehives:beehive")
end end
elseif beenest then elseif beenest then
if silk_touch and not is_creative then if not is_creative then
if silk_touch then
minetest.add_item(pos, "mcl_beehives:bee_nest") minetest.add_item(pos, "mcl_beehives:bee_nest")
awards.unlock(digger:get_player_name(), "mcl:total_beelocation") awards.unlock(digger:get_player_name(), "mcl:total_beelocation")
elseif is_creative and inv:room_for_item("main", "mcl_beehives:bee_nest") then
inv:add_item("main", "mcl_beehives:bee_nest")
else else
mcl_util.deal_damage(digger, 10) mcl_util.deal_damage(digger, 10)
end end
elseif is_creative and inv:room_for_item("main", "mcl_beehives:bee_nest") and not inv:contains_item("main", "mcl_beehives:bee_nest") then
inv:add_item("main", "mcl_beehives:bee_nest")
end
end end
end end