centre apple tree lucky block, check item exists before inserting into chest

This commit is contained in:
tenplus1 2021-04-20 21:33:13 +01:00
parent 5601eb1772
commit b8a76a23b7
2 changed files with 3 additions and 2 deletions

@ -8,7 +8,7 @@ local S, NS = dofile(MP .. "/intllib.lua")
local dpath = minetest.get_modpath("default") .. "/schematics/"
lucky_block:add_schematics({
{"appletree", dpath .. "apple_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
{"appletree", dpath .. "apple_tree_from_sapling.mts", {x = 3, y = 1, z = 3}},
{"jungletree", dpath .. "jungle_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
{"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
{"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}},

@ -180,11 +180,12 @@ local function fill_chest(pos, items)
if not stacks[s].chance
or math.random(1, stacks[s].chance) == 1 then
if minetest.registered_items[stacks[s].name] then
inv:set_stack("main", math.random(32), {
name = stacks[s].name,
count = math.random(stacks[s].max)
})
end
end
end
end