kay27 2021-03-08 04:14:03 +04:00
parent 15fa1e5b7a
commit 6e6809f360
4 changed files with 74 additions and 65 deletions

@ -337,7 +337,7 @@ function mcl_enchanting.get_randomly_enchanted_book(enchantment_level, treasure,
return mcl_enchanting.enchant_randomly(ItemStack("mcl_books:book"), enchantment_level, treasure, no_reduced_bonus_chance, true) return mcl_enchanting.enchant_randomly(ItemStack("mcl_books:book"), enchantment_level, treasure, no_reduced_bonus_chance, true)
end end
function mcl_enchanting.get_uniform_randomly_enchanted_book(except) function mcl_enchanting.get_uniform_randomly_enchanted_book(except, pr)
except = except or except except = except or except
local stack = ItemStack("mcl_enchanting:book_enchanted") local stack = ItemStack("mcl_enchanting:book_enchanted")
local list = {} local list = {}
@ -346,10 +346,19 @@ function mcl_enchanting.get_uniform_randomly_enchanted_book(except)
table.insert(list, enchantment) table.insert(list, enchantment)
end end
end end
local index = math.random(#list) local index, level
if pr then
index = pr:next(1,#list)
else
index = math.random(#list)
end
local enchantment = list[index] local enchantment = list[index]
local enchantment_def = mcl_enchanting.enchantments[enchantment] local enchantment_def = mcl_enchanting.enchantments[enchantment]
local level = math.random(enchantment_def.max_level) if pr then
level = pr:next(1, enchantment_def.max_level)
else
level = math.random(enchantment_def.max_level)
end
mcl_enchanting.enchant(stack, enchantment, level) mcl_enchanting.enchant(stack, enchantment, level)
return stack return stack
end end

@ -38,66 +38,6 @@ local surround_vectors = {
{ x=0, y=0, z=1 }, { x=0, y=0, z=1 },
} }
local loottable =
{
{
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 20 },
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
{ itemstring = "mcl_core:apple_gold", weight = 15 },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}), weight = 10 },
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
}
},
{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:bread", weight = 20 },
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
},
},
{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
},
}
}
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
if mg_name == "v6" then
table.insert(loottable, {
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "", weight = 6 },
},
})
end
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param) local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
if calls_remaining >= 1 then return end if calls_remaining >= 1 then return end
@ -345,6 +285,66 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
minetest.set_node(pos, {name="mcl_chests:chest", param2=facedir}) minetest.set_node(pos, {name="mcl_chests:chest", param2=facedir})
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local loottable =
{
{
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobs:nametag", weight = 20 },
{ itemstring = "mcl_mobitems:saddle", weight = 20 },
{ itemstring = "mcl_jukebox:record_1", weight = 15 },
{ itemstring = "mcl_jukebox:record_4", weight = 15 },
{ itemstring = "mobs_mc:iron_horse_armor", weight = 15 },
{ itemstring = "mcl_core:apple_gold", weight = 15 },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
{ itemstring = "mobs_mc:gold_horse_armor", weight = 10 },
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 2 },
}
},
{
stacks_min = 1,
stacks_max = 4,
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:bread", weight = 20 },
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 },
{ itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_buckets:bucket_empty", weight = 10 },
{ itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 },
},
},
{
stacks_min = 3,
stacks_max = 3,
items = {
{ itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 },
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
},
}
}
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
if mg_name == "v6" then
table.insert(loottable, {
stacks_min = 1,
stacks_max = 3,
items = {
{ itemstring = "mcl_core:birchsapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "mcl_core:acaciasapling", weight = 1, amount_min = 1, amount_max = 2 },
{ itemstring = "", weight = 6 },
},
})
end
mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr) mcl_loot.fill_inventory(meta:get_inventory(), "main", mcl_loot.get_multi_loot(loottable, pr), pr)
end end

@ -432,7 +432,7 @@ local function temple_placement_callback(p1, p2, size, rotation, pr)
{ itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 }, { itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 },
{ itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 }, { itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 },
{ itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 }, { itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}), weight = 20, }, { itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 20, },
{ itemstring = "mcl_mobitems:saddle", weight = 20, }, { itemstring = "mcl_mobitems:saddle", weight = 20, },
{ itemstring = "mcl_core:apple_gold", weight = 20, }, { itemstring = "mcl_core:apple_gold", weight = 20, },
{ itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 },

@ -66,7 +66,7 @@ function tsm_railcorridors.get_treasures(pr)
items = { items = {
{ itemstring = "mcl_mobs:nametag", weight = 30 }, { itemstring = "mcl_mobs:nametag", weight = 30 },
{ itemstring = "mcl_core:apple_gold", weight = 20 }, { itemstring = "mcl_core:apple_gold", weight = 20 },
{ itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}), weight = 10 }, { itemstack = mcl_enchanting.get_uniform_randomly_enchanted_book({"soul_speed"}, pr), weight = 10 },
{ itemstring = "", weight = 5}, { itemstring = "", weight = 5},
{ itemstring = "mcl_core:pick_iron", weight = 5 }, { itemstring = "mcl_core:pick_iron", weight = 5 },
{ itemstring = "mcl_core:apple_gold_enchanted", weight = 1 }, { itemstring = "mcl_core:apple_gold_enchanted", weight = 1 },