本篇教程由作者设定未经允许禁止转载。

用JByteMod-1.8.2打开VillagerRegistryHandler.class,路径:merchants\entity\creatures\Villager

找到如下行,即可进行修改

getstatic VilagerRegistry$VillgerCareer VillagerRegistryHandler.SEED_MERCHANT_CAREER//商人种类此行不动
iconst _ 3      //级别交易的级别,与原版一致
iconst _ 3     //本级项数决定此级交易有多少项交易,比如第6-17行为一项,18到30行为一项
anewarray EntityVilager$ITrade List//交易列表函数此行不动
dup//此行不动
iconst_0//本级项次从0开始,依次加1,比如第19行就是1
new EntityVillager$EmeraldForItems//买或者卖声明函数EntityVillager$EmeraldForItems为收购\函数ModMerchantRecipes$EmeraldForItem也是收购\函数ModMerchantRecipes$ItemForEmerald为出售
dup//此行不动
Idc String "modid:cornseed"//物品ID绿色部分填入交易物品id,此处为玉米种子
nvokestatic Item Item.func_111206_d(String)//forge物品识别函数此行不动
new EntityVillager$PriceInfo//价格声明此行不动
dup//此行不动
bipush 15//价格下限随机生成一个种子商人,玉米种子价格最少是15
bipush 25//价格上限随机生成一个种子商人,玉米种子价格最多是25
invokespecial void EntityVillager$PriceInfo.<init>(int, int)//价格函数此行不动
invokespecial void EntityVillager$EmeraldForItems.<init>(Item, EntityVillager$PriceInfo)//买或者卖函数函数EntityVillager$EmeraldForItems为收购\函数ModMerchantRecipes$EmeraldForItem也是收购\函数ModMerchantRecipes$ItemForEmerald为出售
aastore//此行不动
dup//此行不动
iconst_1//本级项次
20new EntityVillager$EmeraldForItems//买或者卖声明函数EntityVillager$EmeraldForItems为收购\函数ModMerchantRecipes$EmeraldForItem也是收购\函数ModMerchantRecipes$ItemForEmerald为出售
dup//此行不动
Idc String "modid:cornpotato"//物品ID绿色部分填入交易物品id,此处为土豆种子
invokestatic Item Item.func_111206_d(String)//forge物品识别函数此行不动
new EntityVillager$PriceInfo//价格声明此行不动
dup//此行不动
bipush 20//价格下限随机生成一个种子商人,土豆种子价格最少是20
bipush 35//价格上限随机生成一个种子商人,土豆种子价格最多是35
invokespecial void EntityVillager$PriceInfo.<init>(int, int)价格函数此行不动
invokespecial void EntityVillager$EmeraldForItems.<init>(Item, EntityVillager$PriceInfo)//买或者卖函数函数EntityVillager$EmeraldForItems为收购\函数ModMerchantRecipes$EmeraldForItem也是收购\函数ModMerchantRecipes$ItemForEmerald为出售
aastore


百科提供的代码填写不显示区别颜色,我用excel做了个详见下图

回收商:修改村民交易物品列表,兼容forge其他mod-第1张图片