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'],
toolsmith: ['silk_touch', 'fortune'],
weaponsmith: ['sharpness', 'fire_aspect'],
'chefsdelight:delightchef': ['flame', 'fire_aspect'],
'chefsdelight:delightcook': ['flame', 'fire_aspect'],
'sawmill:carpenter': ['knockback', 'fortune'],
delightchef: ['flame', 'fire_aspect'],
delightcook: ['flame', 'fire_aspect'],
carpenter: ['knockback', 'fortune'],
};
// level 2 villagers sell consumables for 2 emerald
@ -84,11 +84,11 @@ const consumables = {
// sword, axe
weaponsmith: ['iron_sword', 'iron_axe', 'golden_sword', 'golden_axe'],
// 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
'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
'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'],
};
@ -184,15 +184,12 @@ MoreJSEvents.villagerTrades((event) => {
event.removeVanillaTrades();
event.removeModdedTrades();
const professions = VillagerUtils.getProfessions();
let profName = '';
let rolls = 0;
let enchantments = null;
let staples = null;
for(const prof of professions) {
profName = prof.name();
rolls = enchant_consumables[profName] || 0;
enchantments = enchantment_list[profName];
staples = consumables[profName];
professions.forEach(prof => {
const profName = prof.name();
if(profName === 'nitwit') return;
const rolls = enchant_consumables[profName] || 0;
const enchantments = enchantment_list[profName];
const staples = consumables[profName];
if(!enchantments) throw new Error("No enchantments for " + profName);
if(!staples) throw new Error("No staples for " + profName);
// 1 level 5 trade
@ -240,5 +237,5 @@ MoreJSEvents.villagerTrades((event) => {
offer.setPriceMultiplier(1);
});
}
}
});
});