Hi, so I'm updating some codes that were tested on 1.7.10 to 1.8.9, what are the replacements for EntityVillager#addDefaultEquipmentAndRecipies, EntityVillager#func_146091_a and MerchantRecipeList#addToListWithCheck?
Did you try looking at the EntityVillager code? Look at where each method is called from in 1.7.10 and find the corresponding place in 1.8.9.
EntityVillager#addDefaultEquipmentAndRecipies was replaced by EntityVillager#populateBuyingList.
EntityVillager#func_146091_a and MerchantRecipeList#addToListWithCheck have no direct replacement, the default trades for each profession are stored in EntityVillager.DEFAULT_TRADE_LIST_MAP and added to the MerchantRecipeList with EntityVillager.ITradeList#modifyMerchantRecipeList instead.
I'd recommend updating to 1.9.4, where villager trades have been fully converted to Forge's career/profession system.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
EntityVillager#func_146091_a and MerchantRecipeList#addToListWithCheck have no direct replacement, the default trades for each profession are stored in EntityVillager.DEFAULT_TRADE_LIST_MAP and added to the MerchantRecipeList with EntityVillager.ITradeList#modifyMerchantRecipeList instead.
Hm, so I replace MerchantRecipeList#addToListWithCheck with EntityVillager.ITradeList#modifyMerchantRecipeList? Entity's code here.
Hm, so I replace MerchantRecipeList#addToListWithCheck with EntityVillager.ITradeList#modifyMerchantRecipeList? Entity's code here.
90% of the code in that class can be deleted. If you extend a class, your class will automatically inherit its fields and methods; copying and pasting that class into your own will only duplicate things.
The only methods you need to override are ones where you add your own behaviour or ones that call EntityVillager#populateBuyingList. The latter is only needed because you can't override private methods, so your populateBuyingList method is completely separate to EntityVillager#populateBuyingList.
If I'm understanding the vanilla code correctly, you need to create an ITradeList array in a static field containing the default trades and then iterate through it and call EntityVillager.ITradeList#modifyMerchantRecipeList for each one in populateBuyingList.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
The only methods you need to override are ones where you add your own behaviour or ones that call EntityVillager#populateBuyingList. The latter is only needed because you can't override private methods, so yourpopulateBuyingList method is completely separate to EntityVillager#populateBuyingList.
If I'm understanding the vanilla code correctly, you need to create an ITradeList array in a static field containing the default trades and then iterate through it and call EntityVillager.ITradeList#modifyMerchantRecipeList for each one in populateBuyingList.
Okay, so I don't need the populateBuyingList method in my Entity class?
It appears in the EntityVillageClass, the ITradeList array is deprecated and a comment says that I should use VillagerRegistry instead. If I am to use VillagerRegistry, where will I put the calling method?
Okay, so I don't need the populateBuyingList method in my Entity class?
You do need that method if you want your own trades.
It appears in the EntityVillageClass, the ITradeList array is deprecated and a comment says that I should use VillagerRegistry instead.
It's deprecated, but Forge never finished implementing custom trades through VillagerRegistry in 1.8.9. VillagerRegistry.VillagerCareer doesn't actually store any trades and is never used.
In 1.9.4, custom trades have been implemented and the VillagerRegistry classes are actually used.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You do need that method if you want your own trades.
It's deprecated, but Forge never finished implementing custom trades through VillagerRegistry in 1.8.9. VillagerRegistry.VillagerCareer doesn't actually store any trades and is never used.
Ah, so I am creating my own populateBuyingList method to load the ITradeList array. That populateBuyingList will then be loaded in updateAITick and getRecipes. Did I get it right?
Ah, so I am creating my own populateBuyingList method to load the ITradeList array. That populateBuyingList will then be loaded in updateAITick and getRecipes. Did I get it right?
Yes. populateBuyingList is also called from EntityVillager#getDisplayName, so you should override that as well.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hi, so I'm updating some codes that were tested on 1.7.10 to 1.8.9, what are the replacements for EntityVillager#addDefaultEquipmentAndRecipies, EntityVillager#func_146091_a and MerchantRecipeList#addToListWithCheck?
Did you try looking at the EntityVillager code? Look at where each method is called from in 1.7.10 and find the corresponding place in 1.8.9.
EntityVillager#addDefaultEquipmentAndRecipies was replaced by EntityVillager#populateBuyingList.
EntityVillager#func_146091_a and MerchantRecipeList#addToListWithCheck have no direct replacement, the default trades for each profession are stored in EntityVillager.DEFAULT_TRADE_LIST_MAP and added to the MerchantRecipeList with EntityVillager.ITradeList#modifyMerchantRecipeList instead.
I'd recommend updating to 1.9.4, where villager trades have been fully converted to Forge's career/profession system.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hm, so I replace MerchantRecipeList#addToListWithCheck with EntityVillager.ITradeList#modifyMerchantRecipeList? Entity's code here.
90% of the code in that class can be deleted. If you extend a class, your class will automatically inherit its fields and methods; copying and pasting that class into your own will only duplicate things.
The only methods you need to override are ones where you add your own behaviour or ones that call EntityVillager#populateBuyingList. The latter is only needed because you can't override private methods, so your populateBuyingList method is completely separate to EntityVillager#populateBuyingList.
If I'm understanding the vanilla code correctly, you need to create an ITradeList array in a static field containing the default trades and then iterate through it and call EntityVillager.ITradeList#modifyMerchantRecipeList for each one in populateBuyingList.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Okay, so I don't need the populateBuyingList method in my Entity class?
It appears in the EntityVillageClass, the ITradeList array is deprecated and a comment says that I should use VillagerRegistry instead. If I am to use VillagerRegistry, where will I put the calling method?
You do need that method if you want your own trades.
It's deprecated, but Forge never finished implementing custom trades through VillagerRegistry in 1.8.9. VillagerRegistry.VillagerCareer doesn't actually store any trades and is never used.
In 1.9.4, custom trades have been implemented and the VillagerRegistry classes are actually used.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Ah, so I am creating my own populateBuyingList method to load the ITradeList array. That populateBuyingList will then be loaded in updateAITick and getRecipes. Did I get it right?
Yes. populateBuyingList is also called from EntityVillager#getDisplayName, so you should override that as well.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
How can I have the gui that appears to be "scrollble" and have more than 1 recipe for the players to trade, not one recipe like the villagers does.
You'll need to figure that out for yourself, I can't help you with it.
You can try following Vswe's tutorial on GUIs here, it may give you some pointers.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.