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
1 changed files with 9 additions and 7 deletions

View File

@ -54,17 +54,19 @@ 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
minetest.add_item(pos, "mcl_beehives:bee_nest") if silk_touch then
awards.unlock(digger:get_player_name(), "mcl:total_beelocation") minetest.add_item(pos, "mcl_beehives:bee_nest")
elseif is_creative and inv:room_for_item("main", "mcl_beehives:bee_nest") then awards.unlock(digger:get_player_name(), "mcl:total_beelocation")
else
mcl_util.deal_damage(digger, 10)
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") inv:add_item("main", "mcl_beehives:bee_nest")
else
mcl_util.deal_damage(digger, 10)
end end
end end
end end