feat: fix

This commit is contained in:
hypercross 2025-11-30 21:51:08 +08:00
parent 72fccde017
commit dfd0f54ef4
1 changed files with 13 additions and 16 deletions

View File

@ -42,9 +42,9 @@ const enchantment_list = {
shepherd: ['knockback', 'aqua_affinity'], shepherd: ['knockback', 'aqua_affinity'],
toolsmith: ['silk_touch', 'fortune'], toolsmith: ['silk_touch', 'fortune'],
weaponsmith: ['sharpness', 'fire_aspect'], weaponsmith: ['sharpness', 'fire_aspect'],
'chefsdelight:delightchef': ['flame', 'fire_aspect'], delightchef: ['flame', 'fire_aspect'],
'chefsdelight:delightcook': ['flame', 'fire_aspect'], delightcook: ['flame', 'fire_aspect'],
'sawmill:carpenter': ['knockback', 'fortune'], carpenter: ['knockback', 'fortune'],
}; };
// level 2 villagers sell consumables for 2 emerald // level 2 villagers sell consumables for 2 emerald
@ -84,11 +84,11 @@ const consumables = {
// sword, axe // sword, axe
weaponsmith: ['iron_sword', 'iron_axe', 'golden_sword', 'golden_axe'], weaponsmith: ['iron_sword', 'iron_axe', 'golden_sword', 'golden_axe'],
// rice, spaghetti, dough, crust // rice, spaghetti, dough, crust
'chefsdelight:delightchef': ['8x farmersdelight:rice', '10x farmersdelight:raw_pasta', '10x farmersdelight:crust', '16x sugar'], delightchef: ['8x farmersdelight:rice', '10x farmersdelight:raw_pasta', '10x farmersdelight:crust', '16x sugar'],
// cut raw meat // cut raw meat
'chefsdelight:delightcook': ['16x bowl', '16x glass_bottle', '1x bucket', '8x farmersdelight:minced_beef', '8x farmersdelight:bacon'], delightcook: ['16x bowl', '16x glass_bottle', '1x bucket', '8x farmersdelight:minced_beef', '8x farmersdelight:bacon'],
// planks // planks
'sawmill:carpenter': ['32x oak_planks', '32x spruce_planks', '32x birch_planks', '32x jungle_planks', '32x pine_planks', '32x bamboo_planks', carpenter: ['32x oak_planks', '32x spruce_planks', '32x birch_planks', '32x jungle_planks', '32x pine_planks', '32x bamboo_planks',
'32x cherry_planks'], '32x cherry_planks'],
}; };
@ -184,15 +184,12 @@ MoreJSEvents.villagerTrades((event) => {
event.removeVanillaTrades(); event.removeVanillaTrades();
event.removeModdedTrades(); event.removeModdedTrades();
const professions = VillagerUtils.getProfessions(); const professions = VillagerUtils.getProfessions();
let profName = ''; professions.forEach(prof => {
let rolls = 0; const profName = prof.name();
let enchantments = null; if(profName === 'nitwit') return;
let staples = null; const rolls = enchant_consumables[profName] || 0;
for(const prof of professions) { const enchantments = enchantment_list[profName];
profName = prof.name(); const staples = consumables[profName];
rolls = enchant_consumables[profName] || 0;
enchantments = enchantment_list[profName];
staples = consumables[profName];
if(!enchantments) throw new Error("No enchantments for " + profName); if(!enchantments) throw new Error("No enchantments for " + profName);
if(!staples) throw new Error("No staples for " + profName); if(!staples) throw new Error("No staples for " + profName);
// 1 level 5 trade // 1 level 5 trade
@ -240,5 +237,5 @@ MoreJSEvents.villagerTrades((event) => {
offer.setPriceMultiplier(1); offer.setPriceMultiplier(1);
}); });
} }
} });
}); });