From c71aec6f9d0570451e6043c1c3846efb53771502 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 22 Feb 2023 10:49:44 -0700 Subject: [PATCH] Add beehives and bee nests to inventory in creative --- mods/ITEMS/mcl_beehives/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index eba1d2c6e..bcdf70f35 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -48,16 +48,21 @@ local dig_hive = function(pos, node, oldmetadata, digger) local beenest = string.find(node.name, "mcl_beehives:bee_nest") local silk_touch = mcl_enchanting.has_enchantment(wield_item, "silk_touch") local is_creative = minetest.is_creative_enabled(digger:get_player_name()) + local inv = digger:get_inventory() if beehive then - if not silk_touch and not is_creative then - mcl_util.deal_damage(digger, 10) + if not is_creative then minetest.add_item(pos, "mcl_beehives:beehive") + 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 + inv:add_item("main", "mcl_beehives:beehive") end elseif beenest then if silk_touch and not is_creative then minetest.add_item(pos, "mcl_beehives:bee_nest") 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 mcl_util.deal_damage(digger, 10) end