From 493839cf11767ca79221d51036cdfa902bad517e Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Mon, 13 Feb 2023 19:54:27 -0700 Subject: [PATCH 1/3] Disable beehive/nest drops in creative --- mods/ITEMS/mcl_beehives/init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index 100277078..eba1d2c6e 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -50,10 +50,12 @@ local dig_hive = function(pos, node, oldmetadata, digger) local is_creative = minetest.is_creative_enabled(digger:get_player_name()) if beehive then - minetest.add_item(pos, "mcl_beehives:beehive") - if not silk_touch and not is_creative then mcl_util.deal_damage(digger, 10) end + if not silk_touch and not is_creative then + mcl_util.deal_damage(digger, 10) + minetest.add_item(pos, "mcl_beehives:beehive") + end elseif beenest then - if silk_touch or is_creative 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") else From c71aec6f9d0570451e6043c1c3846efb53771502 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 22 Feb 2023 10:49:44 -0700 Subject: [PATCH 2/3] 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 From 2f10a8767b10f108bbd43831e21702c26a36cac1 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 22 Feb 2023 20:09:35 -0700 Subject: [PATCH 3/3] Beehives only go into inventory in creative when no beehive exists in the inventory --- mods/ITEMS/mcl_beehives/init.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_beehives/init.lua b/mods/ITEMS/mcl_beehives/init.lua index bcdf70f35..82b3cae5f 100644 --- a/mods/ITEMS/mcl_beehives/init.lua +++ b/mods/ITEMS/mcl_beehives/init.lua @@ -54,17 +54,19 @@ local dig_hive = function(pos, node, oldmetadata, digger) 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 + 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") 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 + if not is_creative then + if silk_touch then + minetest.add_item(pos, "mcl_beehives:bee_nest") + 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") - else - mcl_util.deal_damage(digger, 10) end end end