feat: on trades

This commit is contained in:
hypercross 2025-11-30 17:37:38 +08:00
parent 95cb582977
commit 0d7b06d542
3 changed files with 199 additions and 0 deletions

View File

@ -17,3 +17,47 @@
- [x] diamond armor requires brass crafter
- [x] drill/cutter requires brass
- [x] crying obsidian + glowstone dust -> dimension tears don't need blaze
## trades
- [ ] ideology
- buys food at 1, sells staples at 2, sells gears for gems at 3, sells building stuff, buys/sells rare collectibles at 5
- food includes basic cooked fish, crops and meat, best exp source.
- staples are all player gatherables obtainable easily elsewhere, timesaver.
- trades gems (cinnabar, lapiz, spinel, diamond, silver, gold, crystal) for specific enchantment books.
- sells a type of stone at 4.
- collectibles are rare and must trade with other villagers, best emerald source.
- all trades have 1 stock and 1 exp, except for food which has 5 exp.
- you 1. know them 2. build farm for them 3. buy staples for consumables 4. build houses for them 5. stock up collectibles
- all food are basic one ingredient food and are the same big pool for all villagers.
- all collectibles are the same big pool for all villagers.
- only design staples, gear, and deco for each profession.
- armorer
- staples: low durability chainmail, gold armor
- enchantment: fire prot, prot,
- brick: granite, limestone
- butcher
- staples: various animal meat, bones
- enchantment: sharp, strength
- deco: diorite, tuff
- cartographer
- staples: explorer maps
- enchantment: loot, luck
- deco: deepslate cobble, cobble
- cleric
- staples: glass bottles, spider eyes, rotten flesh
- enchantment: undead killer, spider killer
- deco: nether brick, blackstone
- farmer
- staples: seeds, bonemeal, saplings
- enchantment: efficiency, durable
- deco: mud bricks, dirt
- fisherman
- staples: fish, leech, worm, rods
- enchantment: luck of the sea, lure
- deco: coral blocks
- fletcher
- staples: bows, arrows, crossbows
- enchantment: piercing, reloading
- deco: daub, daub_frame
-

View File

@ -0,0 +1,117 @@
const food_list = [
'8x minecraft:apple',
'8x minecraft:beetroot',
'8x minecraft:baked_potato',
'8x minecraft:bread',
'8x minecraft:carrot',
'8x minecraft:melon_slice',
'8x minecraft:sweet_berries',
'8x farmersdelight:pumpkin_slice',
'8x farmersdelight:cabbage_leaf',
'8x farmersdelight:tomato',
'8x farmersdelight:cooked_rice',
'8x farmersdelight:fried_egg',
'8x neapolitan:strawberries',
'8x neapolitan:banana',
'8x neapolitan:dried_banana',
'8x neapolitan:roasted_adzuki_beans',
'8x neapolitan:mint_candies',
'8x atmospheric:passion_fruit',
'8x atmospheric:currant',
'8x atmospheric:dragon_fruit',
'8x atmospheric:candied_orange_slices',
'8x atmospheric:roasted_yucca_fruit',
];
const deco_list = [
'32x minecraft:diorite',
'32x minecraft:granite',
'32x minecraft:andesite',
'32x minecraft:stone',
'32x minecraft:mossy_cobblestone',
'32x minecraft:blackstone',
'32x minecraft:tuff',
'32x minecraft:dirt',
'32x minecraft:gravel',
'32x minecraft:mud',
'32x minecraft:mud_bricks',
'32x minecraft:stone_bricks',
'32x minecraft:cobbled_deepslate',
'32x supplementaries:daub',
'32x supplementaries:daub_frame',
'32x clayworks:concrete',
];
const feast_list = [
'farmersdelight:rice_roll_medley_block',
'farmersdelight:shepherds_pie_block',
'farmersdelight:honey_glazed_ham_block',
'farmersdelight:stuffed_pumpkin_block',
'farmersdelight:roast_chicken_block',
'farmersdelight:pasta_with_meatballs',
];
const enchantment_list = {
armorer: ['projectile_protection', 'blast_protection'],
butcher: ['sharpness', 'sweeping'],
cartographer: ['looting', 'fortune'],
cleric: ['fire_aspect', 'fire_protection', 'flame'],
farmer: ['efficiency', 'thorns'],
fisherman: ['lure', 'luck_of_the_sea'],
fletcher: ['power', 'punch', 'quick_charge', 'piercing'],
leatherworker: ['feather_falling', 'depth_strider'],
librarian: ['smite', 'bane_of_arthropods'],
mason: ['protection', 'unbreaking'],
shepherd: ['knockback', 'aqua_affinity'],
toolsmith: ['silk_touch', 'fortune'],
weaponsmith: ['sharpness', 'fire_aspect'],
'chefsdelight:delightchef': ['flame', 'fire_aspect'],
'chefsdelight:delightcook': ['flame', 'fire_aspect'],
'sawmill:carpenter': ['knockback', 'fortune'],
}
function roll(list, random){
return list[Math.floor(random.next() * list.length)];
}
MoreJSEvents.villagerTrades((event) => {
return;
event.removeVanillaTrades();
event.removeModdedTrades();
const professions = VillagerUtils.getProfessions();
for(const prof of professions){
event.addCustomTrade(prof, 1, (offer, entity, random) => {
offer.setFirstInput(roll(food_list, random));
offer.setOutput('emerald');
offer.setMaxUses(1);
offer.setVillagerExperience(5);
offer.setPriceMultiplier(1);
});
event.addCustomTrade(prof, 4, (offer, entity, random) => {
offer.setFirstInput('3x emerald');
offer.setOutput(roll(deco_list, random));
offer.setMaxUses(4);
offer.setVillagerExperience(1);
offer.setPriceMultiplier(1);
});
event.addCustomTrade(prof, 4, (offer, entity, random) => {
offer.setFirstInput(roll(feast_list, random));
offer.setOutput('5x emerald');
offer.setMaxUses(1);
offer.setVillagerExperience(1);
offer.setPriceMultiplier(1);
});
// for(const enchant of enchantment_list[prof]){
// const trade = VillagerUtils.createEnchantedItemTrade(['6x emerald'], 'minecraft:enchanted_book');
// trade.maxUses(1);
// trade.villagerExperience(1);
// trade.enchantments(enchant).amount(1);
// event.addTrade(prof, 3, trade);
// }
}
});

View File

@ -1671,6 +1671,44 @@
}
]
},
{
"pakku_id": "OGfrDMPpouh6R3nj",
"type": "MOD",
"side": "CLIENT",
"slug": {
"modrinth": "emitrades"
},
"name": {
"modrinth": "EMI Trades"
},
"id": {
"modrinth": "j2HhbEE7"
},
"files": [
{
"type": "modrinth",
"file_name": "emitrades-forge-1.2.1+mc1.20.1.jar",
"mc_versions": [
"1.20.1"
],
"loaders": [
"forge",
"neoforge"
],
"release_type": "release",
"url": "https://cdn.modrinth.com/data/j2HhbEE7/versions/LBT7pcVH/emitrades-forge-1.2.1+mc1.20.1.jar",
"id": "LBT7pcVH",
"parent_id": "j2HhbEE7",
"hashes": {
"sha512": "b0344906a3da867373edf6a4d5a7bcb1d0aa0aaf11825244b9d1d5aeb1aec1c5d023b754ab8f881905c7086ba11d2cdc5740ba29ab967b4549346531bcbc1b86",
"sha1": "ea86eceb04978bc366fe022bbab5dd5ea0bd3ab4"
},
"required_dependencies": [],
"size": 53378,
"date_published": "2023-11-26T01:20:56.880729Z"
}
]
},
{
"pakku_id": "3MtNCQOTQWS3Ll9u",
"type": "MOD",