From b141f7c0a4dbd93472daf7988c0387b6181ae4d2 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 4 Aug 2024 07:39:05 -0300 Subject: [PATCH 1/2] new special field to solve drop bug --- mods/ENTITIES/mcl_item_entity/init.lua | 7 +++++++ mods/ITEMS/mcl_farming/beetroot.lua | 1 + mods/ITEMS/mcl_farming/wheat.lua | 1 + 3 files changed, 9 insertions(+) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f23d7af42..73a8a7870 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -321,6 +321,7 @@ function minetest.handle_node_drops(pos, drops, digger) if tool and nodedef._mcl_fortune_drop and enchantments.fortune then local fortune_level = enchantments.fortune local fortune_drop = nodedef._mcl_fortune_drop + local simple_drop = nodedef._mcl_fortune_drop.drop_without_fortune if fortune_drop.discrete_uniform_distribution then local min_count = fortune_drop.min_count local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) @@ -336,6 +337,12 @@ function minetest.handle_node_drops(pos, drops, digger) local drop = get_fortune_drops(fortune_drop, fortune_level) drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) end + + if simple_drop then + for _, item in ipairs(simple_drop) do + table.insert(drops, item) + end + end end if digger and mcl_experience.throw_xp and not silk_touch_drop then diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index f32b2bf8e..962fb100e 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -119,6 +119,7 @@ minetest.register_node("mcl_farming:beetroot", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:beetroot_seeds"}, + drop_without_fortune = {"mcl_farming:beetroot_item"}, min_count = 1, max_count = 3, cap = 5, diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 676cc1301..051c5a8d6 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -92,6 +92,7 @@ minetest.register_node("mcl_farming:wheat", { _mcl_fortune_drop = { discrete_uniform_distribution = true, items = {"mcl_farming:wheat_seeds"}, + drop_without_fortune = {"mcl_farming:wheat_item"}, min_count = 1, max_count = 6, cap = 7 From 95653a067634306533aa381631adcbc549c85773 Mon Sep 17 00:00:00 2001 From: JoseDouglas26 Date: Sun, 4 Aug 2024 09:59:27 -0300 Subject: [PATCH 2/2] ipairs to pairs --- mods/ENTITIES/mcl_item_entity/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 73a8a7870..c56102254 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -339,7 +339,7 @@ function minetest.handle_node_drops(pos, drops, digger) end if simple_drop then - for _, item in ipairs(simple_drop) do + for _, item in pairs(simple_drop) do table.insert(drops, item) end end