diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-06-29 20:51:10 +1000 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-06-29 20:51:10 +1000 |
| commit | cccd154da5181349169a06219254b31489925f22 (patch) | |
| tree | 20329d93558a16cb37a5e49050ba10cf7cb7ed43 /src/Java/gtPlusPlus/plugin/villagers/entity/trade | |
| parent | 027caae3989d77a646eef31b8f61f0c748341754 (diff) | |
| download | GT5-Unofficial-cccd154da5181349169a06219254b31489925f22.tar.gz GT5-Unofficial-cccd154da5181349169a06219254b31489925f22.tar.bz2 GT5-Unofficial-cccd154da5181349169a06219254b31489925f22.zip | |
+ Added the base work for custom villagers.
Diffstat (limited to 'src/Java/gtPlusPlus/plugin/villagers/entity/trade')
| -rw-r--r-- | src/Java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java b/src/Java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java new file mode 100644 index 0000000000..61db98e803 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java @@ -0,0 +1,32 @@ +package gtPlusPlus.plugin.villagers.entity.trade; + +import java.util.Random; + +import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.village.MerchantRecipeList; + +public abstract class BaseVillagerTrade implements IVillageTradeHandler { + + + /* + Recently in my mod I started working on a new villager and after doing so I could not figure out to assign new trades to this villager. + Registering the villager + VillagerRegistry.instance().registerVillageTradeHandler(i, new TradeHandler());} + VillagerRegistry.instance().registerVillagerId(8); + VillagerRegistry.instance().registerVillagerSkin(8, new ResourceLocation("chow", "textures/dealer.png")); + VillagerRegistry.instance().getRegisteredVillagers(); + In my trade handler for vanilla villagers it goes off case 0 for instance being the farmer. I thought that it being case 8 would represent the id 8 for the custom villager but it still doesn't work. Could anyone help me out with this please? + * + * + First, you'll need to make a new class that extends IVillageTradeHandler. + In the constructor, add ItemStacks of the items you want it to trade to an ArrayList, + then in the manipulateTradesForVillager method, have it make sure the villager is yours by using villager.getProfession() + and your villager ID, then in a for loop use recipeList.addToListWithCheck to add new instances of MerchantRecipe to your villager's trade list. + Then, in your mod's main class, register the trade handler with VillageRegistry.instance().registerVillagerTradeHandler(villagerId, instanceOfTradeHandler); + */ + + @Override + public abstract void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random); + +} |
