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

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 ipairs(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