net.minecraftforge.fml.common.registry.VillagerRegistry Java Examples

The following examples show how to use net.minecraftforge.fml.common.registry.VillagerRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VillagerTofu1.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static void registerVillager() {
	VillagerProfession prof = VillagerRegistry.FARMER;
	VillagerCareer career = new VillagerCareer(prof, "tofu_trader");
	career.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.material,8,0),new PriceInfo(3, 7)));
	career.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.material,4,2),new PriceInfo(4, 9)));
	career.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.foodset,4,6),new PriceInfo(6, 11)));
	career.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.material,4,30),new PriceInfo(3, 7)));
	career.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.material,4,31),new PriceInfo(3, 7)));
	career.addTrade(2, new SimpleBuy(new ItemStack(ItemLoader.material,4,8),new PriceInfo(4, 9)));
	career.addTrade(2, new SimpleBuy(new ItemStack(ItemLoader.sauce_bottle,1,4),new PriceInfo(2, 6)));
	career.addTrade(2, new SimpleBuy(new ItemStack(ItemLoader.sauce_bottle,1,0),new PriceInfo(2, 6)));
	career.addTrade(2, new SimpleBuy(new ItemStack(ItemLoader.defatting_potion,1),new PriceInfo(4, 6)));
	career.addTrade(3, new SimpleSell(new ItemStack(ItemLoader.material,8,4),new PriceInfo(2, 6)));
}
 
Example #2
Source File: TofuVillages.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
public static void register() {
       // Register the profession of Tofu Cook
       TofuVillages.ProfessionTofuCook = new VillagerRegistry.VillagerProfession("tofucraft:tofuCook",
               new ResourceLocation("tofucraft", "textures/mob/tofucook.png").toString(),//new ResourceLocation("tofucraft", "textures/mob/tofucook.png").toString(),
               "minecraft:textures/entity/zombie_villager/zombie_villager.png");
       TofuVillages.CareerTofuCook = new VillagerRegistry.VillagerCareer(TofuVillages.ProfessionTofuCook, "tofuCook")
               .addTrade(1, new TradeListTCookLv1())
               .addTrade(2, new TradeListTCookLv2())
               .addTrade(3, new TradeListTCookLv4());
       ForgeRegistries.VILLAGER_PROFESSIONS.register((TofuVillages.ProfessionTofuCook));
       VillagerRegistry.getById(0).getCareer(0).addTrade(2, new TradeListFarmerLv2());
   }
 
Example #3
Source File: CommonProxy.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent event) {
    tab = new CreativeTabsTofu();
    new BlockLoader(event);
    new ItemLoader(event);
    TofuEntityRegister.entityRegister();
    MinecraftForge.EVENT_BUS.register(new TofuEventLoader());

    VillagerCreationTofu.registerComponents();
    VillagerCreationTofu villageHandler = new VillagerCreationTofu();
    VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);

    new TofuOreDictLoader();
}
 
Example #4
Source File: CommonProxy.java    From Sakura_mod with MIT License 5 votes vote down vote up
public void preInit(FMLPreInitializationEvent event) {
      tab = new CreativeTabsSakura();
      new PotionLoader(event);
      new BlockLoader(event);
      new ItemLoader(event);
      new DrinksLoader();
      SakuraEntityRegister.entityRegister();
      
      new SakuraOreDictLoader();
      VillagerCreationWA.registerComponents();
VillagerCreationWA villageHandler = new VillagerCreationWA();
VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);
  }
 
Example #5
Source File: TofuVillagerHouse.java    From TofuCraftReload with MIT License 4 votes vote down vote up
protected int chooseProfession(int villagersSpawnedIn, int currentVillagerProfession) {
    ForgeRegistry<VillagerRegistry.VillagerProfession> registry = (ForgeRegistry<VillagerRegistry.VillagerProfession>) ForgeRegistries.VILLAGER_PROFESSIONS;
    int id = registry.getID(TofuVillages.ProfessionTofuCook);
    return id < 0 ? currentVillagerProfession : id;
}
 
Example #6
Source File: WAVillagerHouse.java    From Sakura_mod with MIT License 4 votes vote down vote up
protected int chooseProfession(int villagersSpawnedIn, int currentVillagerProfession)
  {
ForgeRegistry<VillagerRegistry.VillagerProfession> registry = (ForgeRegistry<VillagerProfession>) ForgeRegistries.VILLAGER_PROFESSIONS;
int id = registry.getID(VillagerLoader.wa_villager);
return id < 0 ? currentVillagerProfession : id;
  }
 
Example #7
Source File: VillagerLoader.java    From Sakura_mod with MIT License 4 votes vote down vote up
@SubscribeEvent
public static void onVillagerProfessionRegistration(RegistryEvent.Register<VillagerRegistry.VillagerProfession> event) {
	event.getRegistry().registerAll(wa_villager);

    VillagerRegistry.VillagerCareer farmer = new VillagerRegistry.VillagerCareer(wa_villager, "wa_farmer");
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.CABBAGE,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.EGGPLANT,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.BUCKWHEAT,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.RED_BEAN,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.ONION,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.TOMATO,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.RAPESEED,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.RICE_SEEDS,8),new PriceInfo(2, 4)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.RED_BEAN,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.BUCKWHEAT,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.CABBAGE_SEEDS,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.EGGPLANT_SEEDS,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.ONION_SEEDS,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.RADISH_SEEDS,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.RAPESEED,1),new PriceInfo(5, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.RICE_SEEDS,1),new PriceInfo(4, 7)));
    farmer.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.TOMATO_SEEDS,1),new PriceInfo(5, 7)));
    farmer.addTrade(2, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,37),new PriceInfo(3, 5)));
	
	VillagerRegistry.VillagerCareer fisher = new VillagerRegistry.VillagerCareer(wa_villager, "wa_fisher");
	fisher.addTrade(1, new SimpleSell(new ItemStack(Items.FISH,16),new PriceInfo(1, 3)));
	fisher.addTrade(1, new SimpleBuy(new ItemStack(Items.FISH,8),new PriceInfo(2, 4)));
	fisher.addTrade(1, new SimpleSell(new ItemStack(ItemLoader.FOODSET,16,78),new PriceInfo(2, 4)));
	fisher.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.FOODSET,8,78),new PriceInfo(4, 6)));

	VillagerCareer trader = new VillagerCareer(wa_villager, "wa_trader");
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,3),new PriceInfo(2, 7)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,29),new PriceInfo(3, 6)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,33),new PriceInfo(3, 7)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,45),new PriceInfo(3, 5)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.MATERIAL,8,31),new PriceInfo(2, 5)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.FOODSET,8,63),new PriceInfo(4, 7)));
	trader.addTrade(1, new SimpleBuy(new ItemStack(ItemLoader.FOODSET,8,81),new PriceInfo(3, 5)));
	
	trader.addTrade(3, new SimpleBuy(new ItemStack(ItemLoader.SAKURA_DIAMOND,1),new PriceInfo(12, 23)));
	trader.addTrade(3, new SimpleSell(new ItemStack(ItemLoader.SAKURA_DIAMOND,1),new PriceInfo(8, 10)));
	
	VillagerRegistry.VillagerCareer wine_trader = new VillagerRegistry.VillagerCareer(wa_villager, "wine_trader");
	wine_trader.addTrade(1, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,0),new PriceInfo(20, 30)));
	wine_trader.addTrade(1, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,0),new PriceInfo(10, 20)));
	wine_trader.addTrade(1, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,1),new PriceInfo(20, 30)));
	wine_trader.addTrade(1, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,1),new PriceInfo(10, 20)));
	wine_trader.addTrade(1, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,4),new PriceInfo(20, 30)));
	wine_trader.addTrade(1, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,4),new PriceInfo(10, 20)));
	wine_trader.addTrade(1, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,5),new PriceInfo(20, 30)));
	wine_trader.addTrade(1, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,5),new PriceInfo(10, 20)));

	wine_trader.addTrade(2, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,2),new PriceInfo(40, 60)));
	wine_trader.addTrade(2, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,2),new PriceInfo(20, 35)));
	wine_trader.addTrade(2, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,6),new PriceInfo(40, 60)));
	wine_trader.addTrade(2, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,6),new PriceInfo(20, 35)));
	
	wine_trader.addTrade(3, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,3),new PriceInfo(60, 80)));
	wine_trader.addTrade(3, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,3),new PriceInfo(30, 45)));
	wine_trader.addTrade(3, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,7),new PriceInfo(60, 80)));
	wine_trader.addTrade(3, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,7),new PriceInfo(30, 45)));
	wine_trader.addTrade(3, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,8),new PriceInfo(60, 80)));
	wine_trader.addTrade(3, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,8),new PriceInfo(30, 45)));
	wine_trader.addTrade(3, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,9),new PriceInfo(60, 80)));
	wine_trader.addTrade(3, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,9),new PriceInfo(30, 45)));
	wine_trader.addTrade(3, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,10),new PriceInfo(60, 80)));
	wine_trader.addTrade(3, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,10),new PriceInfo(30, 45)));
	
	wine_trader.addTrade(4, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,11),new PriceInfo(50, 100)));
	wine_trader.addTrade(4, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,11),new PriceInfo(40, 70)));
	wine_trader.addTrade(4, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,12),new PriceInfo(50, 100)));
	wine_trader.addTrade(4, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,12),new PriceInfo(40, 70)));
	wine_trader.addTrade(4, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,13),new PriceInfo(75, 120)));
	wine_trader.addTrade(4, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,13),new PriceInfo(40, 70)));
	wine_trader.addTrade(4, new SimpleBuy(new ItemStack(DrinksLoader.bottle_alcoholic,1,14),new PriceInfo(75, 120)));
	wine_trader.addTrade(4, new SimpleSell(new ItemStack(DrinksLoader.bottle_alcoholic,1,14),new PriceInfo(40, 70)));

}
 
Example #8
Source File: VillageHandlerGuardTower2.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceGuardTower2.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerGuardTower2());
}
 
Example #9
Source File: VillageHandlerBarracks.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceBarracks.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerBarracks());
}
 
Example #10
Source File: VillageHandlerCabin.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceCabin.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerCabin());
}
 
Example #11
Source File: VillageHandlerGuardTower.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceGuardTower.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerGuardTower());
}
 
Example #12
Source File: VillageHandlerShop.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceShop.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerShop());
}
 
Example #13
Source File: VillageHandlerTrophy.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceTrophy.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerTrophy());
}
 
Example #14
Source File: VillageHandlerKeep.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static void init() {
	MapGenStructureIO.registerStructureComponent(VillagePieceKeep.class, NAME);
	VillagerRegistry.instance().registerVillageCreationHandler(new VillageHandlerKeep());
}
 
Example #15
Source File: VillagerTradeHelper.java    From BaseMetals with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Inserts one or more trades to the defaul villager trade table using dark magic (aka java reflection).
 * @param profession Villager profession
 * @param careerID Villager career ID (1-3)
 * @param tradeLevel Level of trade (1+)
 * @param trades Trades to add to the given level
 */
public static void insertTrades(ResourceLocation profession, int careerID, int tradeLevel, EntityVillager.ITradeList... trades) {
	for(EntityVillager.ITradeList trade : trades) {
		VillagerRegistry.instance().getRegistry().getValue(profession).getCareer(careerID-1).addTrade(tradeLevel, trade);
	}
}