diff options
author | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-12 19:38:06 +0100 |
---|---|---|
committer | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-12 19:38:06 +0100 |
commit | 311ab89f93558233a40079f7cb16605b141b5346 (patch) | |
tree | c5f44ef47f441a57c5f57aa801f639c7879ed760 /src/main/java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java | |
parent | 896143b96132f5ac54aa8d8f7386f27487e5e530 (diff) | |
download | GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.gz GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.tar.bz2 GT5-Unofficial-311ab89f93558233a40079f7cb16605b141b5346.zip |
Move sources and resources
Diffstat (limited to 'src/main/java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java')
-rw-r--r-- | src/main/java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java b/src/main/java/gtPlusPlus/plugin/villagers/entity/trade/BaseVillagerTrade.java new file mode 100644 index 0000000000..61db98e803 --- /dev/null +++ b/src/main/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); + +} |