Merge pull request 'Fix for fortune drops in mcl_farming from MCLA' (#4594) from farming_fortune_fix into master

Reviewed-on: VoxeLibre/VoxeLibre#4594
Reviewed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
the-real-herowl 2024-08-27 16:28:39 +02:00
commit 91cecca135
3 changed files with 9 additions and 0 deletions

View File

@ -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 pairs(simple_drop) do
table.insert(drops, item)
end
end
end
if digger and mcl_experience.throw_xp and not silk_touch_drop then

View File

@ -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,

View File

@ -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