new special field to solve drop bug

This commit is contained in:
JoseDouglas26 2024-08-04 07:39:05 -03:00 committed by teknomunk
parent cf9bbb0551
commit b141f7c0a4
3 changed files with 9 additions and 0 deletions

@ -321,6 +321,7 @@ function minetest.handle_node_drops(pos, drops, digger)
if tool and nodedef._mcl_fortune_drop and enchantments.fortune then if tool and nodedef._mcl_fortune_drop and enchantments.fortune then
local fortune_level = enchantments.fortune local fortune_level = enchantments.fortune
local fortune_drop = nodedef._mcl_fortune_drop local fortune_drop = nodedef._mcl_fortune_drop
local simple_drop = nodedef._mcl_fortune_drop.drop_without_fortune
if fortune_drop.discrete_uniform_distribution then if fortune_drop.discrete_uniform_distribution then
local min_count = fortune_drop.min_count local min_count = fortune_drop.min_count
local max_count = fortune_drop.max_count + fortune_level * (fortune_drop.factor or 1) 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) local drop = get_fortune_drops(fortune_drop, fortune_level)
drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2) drops = get_drops(drop, tool:get_name(), dug_node.param2, nodedef.paramtype2)
end end
if simple_drop then
for _, item in ipairs(simple_drop) do
table.insert(drops, item)
end
end
end end
if digger and mcl_experience.throw_xp and not silk_touch_drop then if digger and mcl_experience.throw_xp and not silk_touch_drop then

@ -119,6 +119,7 @@ minetest.register_node("mcl_farming:beetroot", {
_mcl_fortune_drop = { _mcl_fortune_drop = {
discrete_uniform_distribution = true, discrete_uniform_distribution = true,
items = {"mcl_farming:beetroot_seeds"}, items = {"mcl_farming:beetroot_seeds"},
drop_without_fortune = {"mcl_farming:beetroot_item"},
min_count = 1, min_count = 1,
max_count = 3, max_count = 3,
cap = 5, cap = 5,

@ -92,6 +92,7 @@ minetest.register_node("mcl_farming:wheat", {
_mcl_fortune_drop = { _mcl_fortune_drop = {
discrete_uniform_distribution = true, discrete_uniform_distribution = true,
items = {"mcl_farming:wheat_seeds"}, items = {"mcl_farming:wheat_seeds"},
drop_without_fortune = {"mcl_farming:wheat_item"},
min_count = 1, min_count = 1,
max_count = 6, max_count = 6,
cap = 7 cap = 7