Compare commits

...

18 Commits

Author SHA1 Message Date
cora 42f7ee3a81 add jobsites to professions table 2022-05-15 00:54:12 +02:00
cora e7a75e4124 update cleric trades 2022-05-15 00:54:12 +02:00
cora 4257176653 update tool smith trades 2022-05-15 00:54:12 +02:00
cora d3f858e206 update weapon smith trades 2022-05-15 00:54:12 +02:00
cora 114122ebdb update butcher trades 2022-05-15 00:54:12 +02:00
cora 2aaa00ff2d update leatherworker trades 2022-05-15 00:54:12 +02:00
cora 92a1963879 update armorer trades 2022-05-15 00:54:12 +02:00
cora d131c29c96 update cartographer trades 2022-05-15 00:54:09 +02:00
cora e430c88e4b update librarian trades 2022-05-15 00:52:32 +02:00
cora f68a10b393 update fletcher trades 2022-05-15 00:52:32 +02:00
cora c248617ce6 update fisherman trades 2022-05-15 00:52:32 +02:00
cora cbc4590ed2 update farmer trades 2022-05-15 00:52:32 +02:00
cora aabedc2e09 refactor go home logic 2022-05-15 00:52:32 +02:00
cora 5ad1bbb956 Make villagers homeless when bed is gone on return 2022-05-15 00:51:44 +02:00
cora 15455a56d1 increase wait til village generated 2022-05-15 00:51:02 +02:00
cora 3f0cdd6f8b Walk back to bed instead of teleporting 2022-05-15 00:49:59 +02:00
cora a9d5fdd625 Spawn villagers on villagegen, stay in village
This spawns a villager per bed on village gen and saves the bed
position in the entity. If it moves too far from the village
it gets teleported (for now) back.
2022-05-15 00:49:55 +02:00
cora be67954f89 enable simple villager breeding 2022-05-15 00:29:26 +02:00
3 changed files with 289 additions and 102 deletions

View File

@ -170,6 +170,7 @@ mobs_mc.follow = {
dog = { mobs_mc.items.rabbit_raw, mobs_mc.items.rabbit_cooked, mobs_mc.items.mutton_raw, mobs_mc.items.mutton_cooked, mobs_mc.items.beef_raw, mobs_mc.items.beef_cooked, mobs_mc.items.chicken_raw, mobs_mc.items.chicken_cooked, mobs_mc.items.rotten_flesh,
-- Mobs Redo items
"mobs:meat", "mobs:meat_raw" },
villager = { "mcl_farming:bread" },
}
-- Contents for replace_what

View File

@ -62,9 +62,15 @@ if minetest.get_mapgen_setting("mg_name") == "v6" then
end
local professions = {
unemployed = {
name = N("Unemployed"),
texture = "mobs_mc_villager.png",
trades = nil,
},
farmer = {
name = N("Farmer"),
texture = "mobs_mc_villager_farmer.png",
jobsite = "mcl_composters:composter",
trades = {
{
{ { "mcl_farming:wheat_item", 18, 22, }, E1 },
@ -76,16 +82,19 @@ local professions = {
{
{ { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
{ E1, { "mcl_core:apple", 2, 3} },
},
{
{ { "mcl_farming:melon", 7, 12 }, E1 },
{ E1, { "mcl_core:apple", 5, 7 }, },
{ E1, {"mcl_farming:cookie", 5, 7 }, },
},
{
{ E1, { "mcl_farming:cookie", 6, 10 } },
{ E1, { "mcl_cake:cake", 1, 1 } },
{ E1, { "mcl_mushrooms:mushroom_stew", 6, 10 } }, --FIXME: expert level farmer is supposed to sell sus stews.
},
{
{ E1, { "mcl_farming:carrot_item_gold", 3, 10 } },
{ E1, { "mcl_potions:speckled_melon", 4, 1 } },
TRADE_V6_BIRCH_SAPLING,
TRADE_V6_DARK_OAK_SAPLING,
TRADE_V6_ACACIA_SAPLING,
@ -95,32 +104,81 @@ local professions = {
fisherman = {
name = N("Fisherman"),
texture = "mobs_mc_villager_farmer.png",
jobsite = "mcl_barrels:barrel_closed",
trades = {
{
{ { "mcl_fishing:fish_raw", 6, 6, "mcl_core:emerald", 1, 1 }, { "mcl_fishing:fish_cooked", 6, 6 } },
{ { "mcl_fishing:fish_raw", 6, 6, "mcl_core:emerald", 1, 1 },{ "mcl_fishing:fish_cooked", 6, 6 } },
{ { "mcl_mobitems:string", 15, 20 }, E1 },
{ { "mcl_core:emerald", 3, 11 }, { "mcl_fishing:fishing_rod_enchanted", 1, 1} },
{ { "mcl_core:coal_lump", 15, 10 }, E1 },
-- FIXME missing: bucket of cod + fish should be cod.
},
{
{ { "mcl_fishing:fish_raw", 6, 15,}, E1 },
{ { "mcl_fishing:salmon_raw", 6, 6, "mcl_core:emerald", 1, 1 },{ "mcl_fishing:salmon_cooked", 6, 6 } },
-- FIXME missing campfire
-- {{ "mcl_core:emerald", 1, 2 },{"mcl_campfires:campfire",1,1} },
},
{
{ { "mcl_fishing:salmon_raw", 6, 13,}, E1 },
{ { "mcl_core:emerald", 7, 22 }, { "mcl_fishing:fishing_rod_enchanted", 1, 1} },
},
{
{ { "mcl_fishing:clownfish_raw", 6, 6,}, E1 },
},
{
{ { "mcl_fishing:pufferfish_raw", 4, 4,}, E1 },
{ { "mcl_boats:boat", 1, 1,}, E1 },
{ { "mcl_boats:boat_acacia", 1, 1,}, E1 },
{ { "mcl_boats:boat_spruce", 1, 1,}, E1 },
{ { "mcl_boats:boat_dark_oak", 1, 1,}, E1 },
{ { "mcl_boats:boat_birch", 1, 1,}, E1 },
},
},
},
fletcher = {
name = N("Fletcher"),
texture = "mobs_mc_villager_farmer.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: fletching table
trades = {
{
{ { "mcl_mobitems:string", 15, 20 }, E1 },
{ E1, { "mcl_bows:arrow", 8, 12 } },
},
{
{ { "mcl_core:gravel", 10, 10, "mcl_core:emerald", 1, 1 }, { "mcl_core:flint", 6, 10 } },
},
{
{ { "mcl_core:flint", 26, 26 }, E1 },
{ { "mcl_core:emerald", 2, 3 }, { "mcl_bows:bow", 1, 1 } },
},
{
{ { "mcl_mobitems:string", 14, 14 }, E1 },
{ { "mcl_core:emerald", 3, 3 }, { "mcl_bows:crossbow", 1, 1 } },
},
{
{ { "mcl_mobitems:string", 24, 24 }, E1 },
{ { "mcl_core:emerald", 7, 21 } , { "mcl_bows:bow_enchanted", 1, 1 } },
},
{
--FIXME: supposed to be tripwire hook{ { "tripwirehook", 24, 24 }, E1 },
{ { "mcl_core:emerald", 8, 22 } , { "mcl_bows:crossbow_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:healing_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:harming_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:night_vision_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:swiftness_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:slowness_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:leaping_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:poison_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:regeneration_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:invisibility_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:water_breathing_arrow", 5, 5 } },
{ { "mcl_core:emerald", 2, 2, "mcl_bows:arrow", 5, 5 }, { "mcl_potions:fire_resistance_arrow", 5, 5 } },
},
}
},
shepherd ={
name = N("Shepherd"),
texture = "mobs_mc_villager_farmer.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: loom
trades = {
{
{ { "mcl_wool:white", 16, 22 }, E1 },
@ -150,179 +208,261 @@ local professions = {
librarian = {
name = N("Librarian"),
texture = "mobs_mc_villager_librarian.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: lectern
trades = {
{
{ { "mcl_core:paper", 24, 36 }, E1 },
{ { "mcl_books:book", 8, 10 }, E1 },
{ { "mcl_core:emerald", 10, 12 }, { "mcl_compass:compass", 1 ,1 }},
{ { "mcl_core:emerald", 3, 4 }, { "mcl_books:bookshelf", 1 ,1 }},
{ { "mcl_core:emerald", 5, 64 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ { "mcl_core:emerald", 9, 9 }, { "mcl_books:bookshelf", 1 ,1 }},
{ { "mcl_core:emerald", 5, 64, "mcl_books:book", 1, 1 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
},
{
{ { "mcl_books:written_book", 2, 2 }, E1 },
{ { "mcl_core:emerald", 10, 12 }, { "mcl_clock:clock", 1, 1 } },
{ E1, { "mcl_core:glass", 3, 5 } },
{ { "mcl_core:emerald", 5, 64 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ { "mcl_core:emerald", 5, 64, "mcl_books:book", 1, 1 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ E1, { "mcl_lanterns:lantern_floor", 1, 1 } },
},
{
{ E1, { "mcl_core:glass", 3, 5 } },
{ { "mcl_core:emerald", 5, 64 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ { "mcl_dye:black", 5, 5 }, E1 },
{ { "mcl_core:emerald", 5, 64, "mcl_books:book", 1, 1 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ E1, { "mcl_core:glass", 4, 4 } },
},
{
{ { "mcl_core:emerald", 5, 64 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ E1, { "mcl_books:writable_book", 1, 1 } },
{ { "mcl_core:emerald", 5, 64, "mcl_books:book", 1, 1 }, { "mcl_enchanting:book_enchanted", 1 ,1 }},
{ { "mcl_core:emerald", 4, 4 }, { "mcl_compass:compass", 1 ,1 }},
{ { "mcl_core:emerald", 5, 5 }, { "mcl_clock:clock", 1, 1 } },
},
{
{ { "mcl_core:emerald", 20, 22 }, { "mcl_mobs:nametag", 1, 1 } },
{ { "mcl_core:emerald", 20, 20 }, { "mcl_mobs:nametag", 1, 1 } },
}
},
},
cartographer = {
name = N("Cartographer"),
texture = "mobs_mc_villager_librarian.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: cartography table
trades = {
{
{ { "mcl_core:paper", 24, 36 }, E1 },
{ { "mcl_core:paper", 24, 24 }, E1 },
{ { "mcl_core:emerald", 7, 7}, { "mcl_maps:empty_map", 1, 1 } },
},
{
-- compass subject to special checks
{ { "xpanes:pane_natural_flat", 1, 1 }, E1 },
--{ { "mcl_core:emerald", 13, 13, "mcl_compass:compass", 1, 1 }, { "FIXME:ocean explorer map" 1, 1} },
},
{
-- subject to special checks
{ { "mcl_compass:compass", 1, 1 }, E1 },
--{ { "mcl_core:emerald", 13, 13, "mcl_compass:compass", 1, 1 }, { "FIXME:woodland explorer map" 1, 1} },
},
{
-- TODO: replace with empty map
{ { "mcl_core:emerald", 7, 11}, { "mcl_maps:empty_map", 1, 1 } },
{ { "mcl_core:emerald", 7, 7}, { "mcl_itemframes:item_frame", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_white", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_grey", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_silver", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_black", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_red", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_green", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_cyan", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_blue", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_magenta", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_orange", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_purple", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_brown", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_pink", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_lime", 1, 1 }},
{ { "mcl_core:emerald", 7, 7}, { "mcl_banners:banner_item_light_blue", 1, 1 }},
},
{
--{ { "mcl_core:emerald", 8, 8}, { "FIXME: globe banner pattern", 1, 1 } },
},
-- TODO: special maps
},
},
armorer = {
name = N("Armorer"),
texture = "mobs_mc_villager_smith.png",
jobsite = "mcl_core:lava_source", --FIXME: blast furnace
trades = {
{
{ { "mcl_core:coal_lump", 16, 24 }, E1 },
{ { "mcl_core:emerald", 4, 6 }, { "mcl_armor:helmet_iron", 1, 1 } },
{ { "mcl_core:coal_lump", 15, 15 }, E1 },
{ { "mcl_core:emerald", 5, 5 }, { "mcl_armor:helmet_iron", 1, 1 } },
{ { "mcl_core:emerald", 9, 9 }, { "mcl_armor:chestplate_iron", 1, 1 } },
{ { "mcl_core:emerald", 7, 7 }, { "mcl_armor:leggings_iron", 1, 1 } },
{ { "mcl_core:emerald", 4, 4 }, { "mcl_armor:boots_iron", 1, 1 } },
},
{
{ { "mcl_core:iron_ingot", 7, 9 }, E1 },
{ { "mcl_core:emerald", 10, 14 }, { "mcl_armor:chestplate_iron", 1, 1 } },
{ { "mcl_core:iron_ingot", 4, 4 }, E1 },
--{ { "mcl_core:emerald", 36, 36 }, { "FIXME: Bell", 1, 1 } },
{ { "mcl_core:emerald", 3, 3 }, { "mcl_armor:leggings_chain", 1, 1 } },
{ { "mcl_core:emerald", 1, 1 }, { "mcl_armor:boots_chain", 1, 1 } },
},
{
{ { "mcl_buckets:bucket_lava", 1, 1 }, E1 },
{ { "mcl_core:diamond", 1, 1 }, E1 },
{ { "mcl_core:emerald", 1, 1 }, { "mcl_armor:helmet_chain", 1, 1 } },
{ { "mcl_core:emerald", 4, 4 }, { "mcl_armor:chestplate_chain", 1, 1 } },
{ { "mcl_core:emerald", 5, 5 }, { "mcl_shields:shield", 1, 1 } },
},
{
{ { "mcl_core:diamond", 3, 4 }, E1 },
{ { "mcl_core:emerald", 16, 19 }, { "mcl_armor:chestplate_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 19, 33 }, { "mcl_armor:leggings_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 13, 27 }, { "mcl_armor:boots_diamond_enchanted", 1, 1 } },
},
{
{ { "mcl_core:emerald", 5, 7 }, { "mcl_armor:boots_chain", 1, 1 } },
{ { "mcl_core:emerald", 9, 11 }, { "mcl_armor:leggings_chain", 1, 1 } },
{ { "mcl_core:emerald", 5, 7 }, { "mcl_armor:helmet_chain", 1, 1 } },
{ { "mcl_core:emerald", 11, 15 }, { "mcl_armor:chestplate_chain", 1, 1 } },
{ { "mcl_core:emerald", 13, 27 }, { "mcl_armor:helmet_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 21, 35 }, { "mcl_armor:chestplate_diamond_enchanted", 1, 1 } },
},
},
},
leatherworker = {
name = N("Leatherworker"),
texture = "mobs_mc_villager_butcher.png",
jobsite = "mcl_cauldrons:cauldron",
trades = {
{
{ { "mcl_mobitems:leather", 9, 12 }, E1 },
{ { "mcl_core:emerald", 2, 4 }, { "mcl_armor:leggings_leather", 2, 4 } },
{ { "mcl_core:emerald", 3, 3 }, { "mcl_armor:leggings_leather", 2, 4 } },
{ { "mcl_core:emerald", 7, 7 }, { "mcl_armor:chestplate_leather", 2, 4 } },
},
{
{ { "mcl_core:emerald", 7, 12 }, { "mcl_armor:chestplate_leather_enchanted", 1, 1 } },
{ { "mcl_core:flint", 26, 26 }, E1 },
{ { "mcl_core:emerald", 5, 5 }, { "mcl_armor:helmet_leather", 2, 4 } },
{ { "mcl_core:emerald", 4, 4 }, { "mcl_armor:boots_leather", 2, 4 } },
},
{
{ { "mcl_mobitems:rabbit_hide", 9, 9 }, E1 },
{ { "mcl_core:emerald", 7, 7 }, { "mcl_armor:chestplate_leather", 1, 1 } },
},
{
--{ { "FIXME: scute", 4, 4 }, E1 },
{ { "mcl_core:emerald", 8, 10 }, { "mcl_mobitems:saddle", 1, 1 } },
},
{
{ { "mcl_core:emerald", 6, 6 }, { "mcl_mobitems:saddle", 1, 1 } },
{ { "mcl_core:emerald", 5, 5 }, { "mcl_armor:helmet_leather", 2, 4 } },
},
},
},
butcher = {
name = N("Butcher"),
texture = "mobs_mc_villager_butcher.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: smoker
trades = {
{
{ { "mcl_mobitems:beef", 14, 18 }, E1 },
{ { "mcl_mobitems:chicken", 14, 18 }, E1 },
{ { "mcl_mobitems:beef", 14, 14 }, E1 },
{ { "mcl_mobitems:chicken", 7, 7 }, E1 },
{ { "mcl_mobitems:rabbit", 4, 4 }, E1 },
{ E1, { "mcl_mobitems:rabbit_stew", 1, 1 } },
},
{
{ { "mcl_core:coal_lump", 16, 24 }, E1 },
{ E1, { "mcl_mobitems:cooked_beef", 5, 7 } },
{ E1, { "mcl_mobitems:cooked_chicken", 6, 8 } },
{ { "mcl_core:coal_lump", 15, 15 }, E1 },
{ E1, { "mcl_mobitems:cooked_porkchop", 5, 5 } },
{ E1, { "mcl_mobitems:cooked_chicken", 8, 8 } },
},
{
{ { "mcl_mobitems:mutton", 7, 7 }, E1 },
{ { "mcl_mobitems:beef", 10, 10 }, E1 },
},
{
{ { "mcl_mobitems:mutton", 7, 7 }, E1 },
{ { "mcl_mobitems:beef", 10, 10 }, E1 },
},
{
--{ { "FIXME: Sweet Berries", 10, 10 }, E1 },
},
},
},
weapon_smith = {
name = N("Weapon Smith"),
texture = "mobs_mc_villager_smith.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: grindstone
trades = {
{
{ { "mcl_core:coal_lump", 16, 24 }, E1 },
{ { "mcl_core:emerald", 6, 8 }, { "mcl_tools:axe_iron", 1, 1 } },
{ { "mcl_core:coal_lump", 15, 15 }, E1 },
{ { "mcl_core:emerald", 3, 3 }, { "mcl_tools:axe_iron", 1, 1 } },
{ { "mcl_core:emerald", 7, 21 }, { "mcl_tools:sword_iron_enchanted", 1, 1 } },
},
{
{ { "mcl_core:iron_ingot", 7, 9 }, E1 },
{ { "mcl_core:emerald", 9, 10 }, { "mcl_tools:sword_iron_enchanted", 1, 1 } },
{ { "mcl_core:iron_ingot", 4, 4 }, E1 },
--{ { "mcl_core:emerald", 36, 36 }, { "FIXME: Bell", 1, 1 } },
},
{
{ { "mcl_core:flint", 7, 9 }, E1 },
},
{
{ { "mcl_core:diamond", 7, 9 }, E1 },
{ { "mcl_core:emerald", 17, 31 }, { "mcl_tools:axe_diamond_enchanted", 1, 1 } },
},
{
{ { "mcl_core:diamond", 3, 4 }, E1 },
{ { "mcl_core:emerald", 12, 15 }, { "mcl_tools:sword_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 9, 12 }, { "mcl_tools:axe_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 13, 27 }, { "mcl_tools:sword_diamond_enchanted", 1, 1 } },
},
},
},
tool_smith = {
name = N("Tool Smith"),
texture = "mobs_mc_villager_smith.png",
jobsite = "mcl_villages:stonebrickcarved", --FIXME: smithing table
trades = {
{
{ { "mcl_core:coal_lump", 16, 24 }, E1 },
{ { "mcl_core:emerald", 5, 7 }, { "mcl_tools:shovel_iron_enchanted", 1, 1 } },
{ { "mcl_core:coal_lump", 15, 15 }, E1 },
{ E1, { "mcl_tools:axe_stone", 1, 1 } },
{ E1, { "mcl_tools:shovel_stone", 1, 1 } },
{ E1, { "mcl_tools:pick_stone", 1, 1 } },
{ E1, { "mcl_farming:hoe_stone", 1, 1 } },
},
{
{ { "mcl_core:iron_ingot", 7, 9 }, E1 },
{ { "mcl_core:emerald", 9, 11 }, { "mcl_tools:pick_iron_enchanted", 1, 1 } },
{ { "mcl_core:iron_ingot", 4, 4 }, E1 },
--{ { "mcl_core:emerald", 36, 36 }, { "FIXME: Bell", 1, 1 } },
},
{
{ { "mcl_core:diamond", 3, 4 }, E1 },
{ { "mcl_core:emerald", 12, 15 }, { "mcl_tools:pick_diamond_enchanted", 1, 1 } },
{ { "mcl_core:flint", 30, 30 }, E1 },
{ { "mcl_core:emerald", 6, 20 }, { "mcl_tools:axe_iron_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 7, 21 }, { "mcl_tools:shovel_iron_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 8, 22 }, { "mcl_tools:pick_iron_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 4, 4 }, { "mcl_farming:hoe_diamond", 1, 1 } },
},
{
{ { "mcl_core:diamond", 1, 1 }, E1 },
{ { "mcl_core:emerald", 17, 31 }, { "mcl_tools:axe_diamond_enchanted", 1, 1 } },
{ { "mcl_core:emerald", 10, 24 }, { "mcl_tools:shovel_diamond_enchanted", 1, 1 } },
},
{
{ { "mcl_core:emerald", 18, 32 }, { "mcl_tools:pick_diamond_enchanted", 1, 1 } },
},
},
},
cleric = {
name = N("Cleric"),
texture = "mobs_mc_villager_priest.png",
jobsite = "mcl_brewing:stand",
trades = {
{
{ { "mcl_mobitems:rotten_flesh", 36, 40 }, E1 },
{ { "mcl_core:gold_ingot", 8, 10 }, E1 },
{ { "mcl_mobitems:rotten_flesh", 32, 32 }, E1 },
{ E1, { "mesecons:redstone", 2, 2 } },
},
{
{ E1, { "mesecons:redstone", 1, 4 } },
{ E1, { "mcl_dye:blue", 1, 2 } },
{ { "mcl_core:gold_ingot", 3, 3 }, E1 },
{ E1, { "mcl_dye:blue", 1, 1 } },
},
{
{ E1, { "mcl_nether:glowstone", 1, 3 } },
{ { "mcl_core:emerald", 4, 7 }, { "mcl_throwing:ender_pearl", 1, 1 } },
{ { "mcl_mobitems:rabbit_foot", 2, 2 }, E1 },
{ E1, { "mcl_nether:glowstone", 4, 4 } },
},
{
--{ { "FIXME: scute", 4, 4 }, E1 },
{ { "mcl_potions:glass_bottle", 9, 9 }, E1 },
{ { "mcl_core:emerald", 5, 5 }, { "mcl_throwing:ender_pearl", 1, 1 } },
TRADE_V6_RED_SANDSTONE,
},
{
{ { "mcl_nether:nether_wart_item", 22, 22 }, E1 },
{ { "mcl_core:emerald", 3, 3 }, { "mcl_experience:bottle", 1, 1 } },
@ -347,6 +487,42 @@ local stand_still = function(self)
self.jump = false
end
local function set_velocity(self, v)
local yaw = (self.object:get_yaw() or 0) + self.rotate
self.object:set_velocity({
x = (math.sin(yaw) * -v),
y = self.object:get_velocity().y,
z = (math.cos(yaw) * v),
})
end
local function go_to_pos(entity,b)
local s=entity.object:get_pos()
local v = { x = b.x - s.x, z = b.z - s.z }
local yaw = (math.atan(v.z / v.x) + math.pi / 2) - entity.rotate
if b.x > s.x then yaw = yaw + math.pi end
entity.object:set_yaw(yaw)
set_velocity(entity,entity.follow_velocity)
if vector.distance(b,s) < 5 then
return true
end
end
local function go_home(entity)
entity.state = "go_home"
local b=entity.bed
if not b then return end
if go_to_pos(entity,b) then
entity.state = "stand"
set_velocity(entity,0)
entity.object:set_pos(b)
local n=minetest.get_node(b)
if n and n.name ~= "mcl_beds:bed_red_bottom" then
entity.bed=nil --the stormtroopers have killed uncle owen
end
end
end
local update_max_tradenum = function(self)
if not self._trades then
return
@ -991,11 +1167,19 @@ mobs:register_mob("mobs_mc:villager", {
die_end = 220,
die_loop = false,
},
follow = mobs_mc.follow.villager,
view_range = 16,
fear_height = 4,
jump = true,
walk_chance = DEFAULT_WALK_CHANCE,
on_rightclick = function(self, clicker)
if clicker:get_wielded_item():get_name() == "mcl_farming:bread" then
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
end
if self.child then
return
end
-- Initiate trading
local name = clicker:get_player_name()
self._trading_players[name] = true
@ -1037,6 +1221,11 @@ mobs:register_mob("mobs_mc:villager", {
if not self._player_scan_timer then
self._player_scan_timer = 0
end
if self.bed and ( self.state == "go_home" or vector.distance(self.object:get_pos(),self.bed) > 50 ) then
go_home(self)
end
self._player_scan_timer = self._player_scan_timer + dtime
-- Check infrequently to keep CPU load low
if self._player_scan_timer > PLAYER_SCAN_INTERVAL then

View File

@ -317,7 +317,7 @@ end
local function init_nodes(p1, rotation, pr, size)
local p2 = vector.subtract(vector.add(p1, size), 1)
local nodes = minetest.find_nodes_in_area(p1, p2, {"mcl_itemframes:item_frame", "mcl_furnaces:furnace", "mcl_anvils:anvil", "mcl_chests:chest", "mcl_villages:stonebrickcarved"})
local nodes = minetest.find_nodes_in_area(p1, p2, {"mcl_itemframes:item_frame", "mcl_furnaces:furnace", "mcl_anvils:anvil", "mcl_chests:chest"})
for _, pos in pairs(nodes) do
local name = minetest_get_node(pos).name
local def = minetest_registered_nodes[minetest_get_node(pos).name]
@ -366,12 +366,6 @@ local function place_schematics(plan, pr)
end
end
--
-- register block for npc spawn
--
local function spawn_villager(pos)
minetest.add_entity({x = pos.x, y = pos.y + 1, z = pos.z}, "mobs_mc:villager")
end
minetest.register_node("mcl_villages:stonebrickcarved", {
description = S("Chiseled Stone Village Bricks"),
_doc_items_longdesc = doc.sub.items.temp.build,
@ -383,35 +377,18 @@ minetest.register_node("mcl_villages:stonebrickcarved", {
is_ground_content = false,
_mcl_blast_resistance = 6,
_mcl_hardness = 1.5,
on_construct = spawn_villager,
})
minetest.register_abm({
label = "Spawn villagers",
nodenames = {"mcl_villages:stonebrickcarved"},
interval = 60,
chance = 3,
action = function(pos, node)
-- check the space above
local p = table.copy(pos)
p.y = p.y + 1
if minetest_get_node(p).name ~= "air" then return end
p.y = p.y + 1
if minetest_get_node(p).name ~= "air" then return end
p.y = p.y - 1
local villagers_counter = 0
for _, obj in pairs(minetest.get_objects_inside_radius(p, 40)) do
local lua_entity = obj:get_luaentity()
if luaentity and luaentity.name == "mobs_mc:villager" then
villagers_counter = villagers_counter + 1
if villagers_counter > 7 then return end
end
local function spawn_villagers(minp,maxp)
local beds=minetest.find_nodes_in_area(minp,maxp,{"mcl_beds:bed_red_bottom"})
for _,bed in pairs(beds) do
minetest.get_meta(bed):set_string("villagebed","true")
local v=minetest.add_entity(bed,"mobs_mc:villager")
if v then
v:get_luaentity().bed = bed
end
spawn_villager(pos)
end
})
end
--
-- on map generation, try to build a settlement
@ -433,6 +410,26 @@ local function build_a_village(minp, maxp, pr, placer)
place_schematics(plan, pr)
villages[#villages + 1] = minp
storage:set_string("villages", minetest.serialize(villages))
minetest.after(60,function()
spawn_villagers(minp,maxp)
end)
--[[ Enable for testing, but use MineClone2's own spawn code if/when merging.
--
-- register inhabitants
--
if minetest.get_modpath("mobs_mc") then
mobs:register_spawn("mobs_mc:villager", --name
{"mcl_core:stonebrickcarved"}, --nodes
15, --max_light
0, --min_light
20, --chance
7, --active_object_count
31000, --max_height
nil) --day_toggle
end
--]]
end
-- Disable natural generation in singlenode.