net.minecraft.village.MerchantRecipeList Java Examples

The following examples show how to use net.minecraft.village.MerchantRecipeList. 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: EntityShopkeeper.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
protected MerchantRecipeList createTradesBaseOnRep(EntityPlayer player) {
	RepData rep = getReputation(player);
	switch (rep.civ) {
	case WIND:
		return ShopkeeperTradesForWind.trades(player, rep.rep);
	case EARTH:
		return ShopkeeperTradesForEarth.trades(player, rep.rep);
	case FIRE:
		return ShopkeeperTradesForFire.trades(player, rep.rep);
	case MOON:
		return ShopkeeperTradesForMoon.trades(player, rep.rep);
	case SUN:
		return ShopkeeperTradesForSun.trades(player, rep.rep);
	case WATER:
		return ShopkeeperTradesForWater.trades(player, rep.rep);
	default:
		return new MerchantRecipeList();
	}
}
 
Example #2
Source File: VillagerHereticManager.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
    if(villager.getProfession() == Config.hereticID) {
        /*recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 20 + random.nextInt(3), 18), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 9)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 4 + random.nextInt(3), 3), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemResource, 4 + random.nextInt(3), 6), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemResource, 1, 1)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemNuggetChicken, 24 + random.nextInt(8), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.book, 4 + random.nextInt(3), 0), new ItemStack(ConfigItems.itemResource, 1, 9)));
        recipeList.add(new MerchantRecipe(new ItemStack(ConfigItems.itemNuggetBeef, 24 + random.nextInt(8), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemShard, 2 + random.nextInt(2), random.nextInt(6))));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald), new ItemStack(ConfigItems.itemManaBean, 1 + random.nextInt(2), 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemBathSalts, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemRingRunic, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemAmuletVis, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 5 + random.nextInt(3)), new ItemStack(ConfigItems.itemBaubleBlanks, 1, 3 + random.nextInt(6))));
        */
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(2)), new ItemStack(ForbiddenItems.deadlyShards, 3 + random.nextInt(2), 6)));
        if(!Config.noLust)
            recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 2 + random.nextInt(4), 4), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.deadlyShards, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(ForbiddenItems.gluttonyShard, 4 + random.nextInt(6), 0), new ItemStack(Items.emerald)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1 + random.nextInt(3)), new ItemStack(Items.skull, 1, 0)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(4)), new ItemStack(Items.ghast_tear, 1)));
        recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(Items.glowstone_dust, 8 + random.nextInt(9))));

        ItemStack wand = new ItemStack(ConfigItems.itemWandCasting, 1, 36);
        ((ItemWandCasting) wand.getItem()).setCap(wand, (WandCap) WandCap.caps.get("iron"));
        ((ItemWandCasting) wand.getItem()).setRod(wand, (WandRod) WandRod.rods.get("profane"));
        ((ItemWandCasting) wand.getItem()).storeAllVis(wand, new AspectList().add(Aspect.FIRE, 5000).add(Aspect.WATER, 5000).add(Aspect.EARTH, 5000).add(Aspect.AIR, 5000).add(Aspect.ORDER, 5000).add(Aspect.ENTROPY, 5000));
        MerchantRecipe profane = new MerchantRecipe(new ItemStack(Items.emerald, 8 + random.nextInt(5)), new ItemStack(Items.stick), wand);
        profane.func_82783_a(-6);
        recipeList.add(profane);
        MerchantRecipe fire = new MerchantRecipe(new ItemStack(Items.emerald, 4 + random.nextInt(5)), new ItemStack(Items.diamond, 1), new ItemStack(ConfigItems.itemFocusFire, 1));
        fire.func_82783_a(-6);
        recipeList.add(fire);
    }

}
 
Example #3
Source File: ShopkeeperTradesForFire.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Sword()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(7)), level1Bow()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(15)), level2Bow()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(3)), level1FireProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(6)), level2FireProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(9)), level3FireProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(15)), level4FireProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level5FireProtection()));
	}
	
	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(4)), new ItemStack(Items.CHICKEN, 1), new ItemStack(ItemSpicyChicken.INSTANCE)));
	}

	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(Blocks.MAGMA, 3), new ItemStack(ItemFireSword.INSTANCE)));
	}

	if (rep.equals(ReputationLevel.HERO)) {

	}

	return recipeList;
}
 
Example #4
Source File: ShopkeeperTradesForWater.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Boots()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Helmet()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Helmet()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Helmet()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Helmet()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Helmet()));
	}
	
	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {

	}

	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 3), new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(ItemBattleAxe.INSTANCE)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(25)), loChangsRod()));
	}

	if (rep.equals(ReputationLevel.HERO)) {

	}

	return recipeList;
}
 
Example #5
Source File: ShopkeeperTradesForEarth.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Pick()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Pick()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Pick()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Pick()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Pick()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(9)), silkTouch()));
	}

	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {

	}
	
	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 3), new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(ItemBattleAxe.INSTANCE)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 5), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemToroArmor.helmetItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 7), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemToroArmor.leggingsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 4), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemToroArmor.bootsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 8), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemToroArmor.chestplateItem)));
	}

	if (rep.equals(ReputationLevel.HERO)) {

	}

	return recipeList;
}
 
Example #6
Source File: ShopkeeperTradesForWind.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(15)), level1Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level2Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(15)), level1Bow()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level2Bow()));

		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Boots()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Boots()));
	}

	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {

	}

	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 3), new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(ItemBattleAxe.INSTANCE)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 5), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemRoyalArmor.helmetItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 7), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemRoyalArmor.leggingsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 4), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemRoyalArmor.bootsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 8), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemRoyalArmor.chestplateItem)));
	}

	if (rep.equals(ReputationLevel.HERO)) {
		/*
		 * only the best here
		 */
	}

	return recipeList;
}
 
Example #7
Source File: ShopkeeperTradesForMoon.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Sword()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Chestplate()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Chestplate()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Chestplate()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Chestplate()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Chestplate()));
	}
	
	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(Items.QUARTZ, 20), new ItemStack(ItemPickaxeOfGreed.INSTANCE)));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(Items.QUARTZ, 20), new ItemStack(ItemSwordOfPain.INSTANCE)));
	}

	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(Blocks.OBSIDIAN, 3), new ItemStack(ItemObsidianSword.INSTANCE)));
	}

	if (rep.equals(ReputationLevel.HERO)) {

	}

	return recipeList;
}
 
Example #8
Source File: ShopkeeperTradesForSun.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static MerchantRecipeList trades(EntityPlayer player, ReputationLevel rep) {
	MerchantRecipeList recipeList = new MerchantRecipeList();

	if (rep.equals(ReputationLevel.DRIFTER) || rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(5)), level1Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(10)), level2Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(20)), level3Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(30)), level4Sword()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(40)), level5Sword()));
		
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(3)), level1BlastProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(6)), level2BlastProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(9)), level3BlastProtection()));
		recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, rep.adjustPrice(15)), level4BlastProtection()));
	}

	if (rep.equals(ReputationLevel.FRIEND) || rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {

	}
	
	if (rep.equals(ReputationLevel.ALLY) || rep.equals(ReputationLevel.HERO)) {
		recipeList.add(new MerchantRecipe(new ItemStack(Items.DIAMOND, 3), new ItemStack(Items.EMERALD, rep.adjustPrice(5)), new ItemStack(ItemBattleAxe.INSTANCE)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 5), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemSamuraiArmor.helmetItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 7), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemSamuraiArmor.leggingsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 4), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemSamuraiArmor.bootsItem)));
		recipeList.add(new MerchantRecipe(new ItemStack(ItemToroLeather.INSTANCE, 8), new ItemStack(Items.EMERALD, 5), new ItemStack(ItemSamuraiArmor.chestplateItem)));
	}

	if (rep.equals(ReputationLevel.HERO)) {

	}

	return recipeList;
}
 
Example #9
Source File: CraftMerchant.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setRecipes(List<MerchantRecipe> recipes) {
    MerchantRecipeList recipesList = merchant.getRecipes(null);
    recipesList.clear();
    for (MerchantRecipe recipe : recipes) {
        recipesList.add(CraftMerchantRecipe.fromBukkit(recipe).toMinecraft());
    }
}
 
Example #10
Source File: VillagerTrades.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Invoked when the merchant generates its trade menu
 * @param recipeList existing trade menu
 * @param random a psuedorandom number generator instance
 */
@Override
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
	for(int n = 0; n < numberOfTrades; n++){
		trades[random.nextInt(trades.length)].modifyMerchantRecipeList(recipeList,random);
	}
}
 
Example #11
Source File: VillagerTrades.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Invoked when the merchant generates its trade menu
 * @param recipeList existing trade menu
 * @param random a psuedorandom number generator instance
 */
@Override
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
	int numTrades = -1;
	if(maxTrades > 0){
		if(maxTradeVariation > 0){
			numTrades = Math.max(1,maxTrades +  random.nextInt(maxTradeVariation) - maxTradeVariation / 2);
		} else {
			numTrades = maxTrades;
		}
	}
	ItemStack in1 = input1.copy();
	if(maxInputMarkup1 > 0) in1.stackSize = in1.stackSize + random.nextInt(maxInputMarkup1);
	ItemStack in2 = null;
	if(input2 != null && input2.getItem() != null){
		in2 = input2.copy();
		if(maxInputMarkup2 > 0) in2.stackSize = in2.stackSize + random.nextInt(maxInputMarkup2);
	}
	ItemStack out = output.copy();
	if(maxOutputMarkup > 0) out.stackSize = out.stackSize + random.nextInt(maxOutputMarkup);
	
	if(numTrades > 0){
		recipeList.add(new MerchantRecipe(in1,in2,out,0,numTrades));
	}else{
		recipeList.add(new MerchantRecipe(in1,in2,out));
	}
}
 
Example #12
Source File: CraftingRegistrator.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static void registerAmadronOffers(){
    PneumaticRecipeRegistry registry = PneumaticRecipeRegistry.getInstance();
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.PCBBlueprint));
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.assemblyProgram, 1, 0));
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.assemblyProgram, 1, 1));
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 14), new ItemStack(Itemss.assemblyProgram, 1, 2));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.oil, 5000), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.diesel, 4000), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.lubricant, 2500), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.kerosene, 3000), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.gasoline, 2000), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.lpg, 1000), new ItemStack(Items.emerald, 1));
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald), new FluidStack(Fluids.oil, 1000));
    registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 5), new FluidStack(Fluids.lubricant, 1000));

    for(int i = 0; i < 256; i++) {
        try {
            for(int j = 0; j < 10; j++) {
                EntityVillager villager = new EntityVillager(null, i);
                MerchantRecipeList list = villager.getRecipes(null);
                for(MerchantRecipe recipe : (List<MerchantRecipe>)list) {
                    if(recipe.getSecondItemToBuy() == null && recipe.getItemToBuy() != null && recipe.getItemToBuy().getItem() != null && recipe.getItemToSell() != null && recipe.getItemToSell().getItem() != null) {
                        registry.registerDefaultPeriodicAmadronOffer(recipe.getItemToBuy(), recipe.getItemToSell());
                    }
                }
            }
        } catch(Throwable e) {}
    }
}
 
Example #13
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public void initTrades() {
    int j = this.tofunianCareerLevel;
    MerchantRecipeList trades = this.settingTrade(j);

    if (trades != null) {
        if (this.buyingList == null) {
            this.buyingList = trades;
        } else {
            this.buyingList = trades;
        }
    }
}
 
Example #14
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Nullable
public MerchantRecipeList getRecipes(EntityPlayer player) {
    if (this.buyingList == null) {
        this.initTrades();
    }

    return net.minecraftforge.event.ForgeEventFactory.listTradeOffers(this, player, buyingList);
}
 
Example #15
Source File: VillagerHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){
    recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(net.minecraft.init.Items.emerald, 10 + rand.nextInt(10)), null, new ItemStack(Itemss.PCBBlueprint)));
    for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
        recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(net.minecraft.init.Items.emerald, rand.nextInt(5) + 7), null, new ItemStack(Itemss.assemblyProgram, 1, i)));
    }
    recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(net.minecraft.init.Items.emerald, rand.nextInt(5) + 1), null, new ItemStack(Itemss.nukeVirus)));
    recipeList.addToListWithCheck(new MerchantRecipe(new ItemStack(net.minecraft.init.Items.emerald, rand.nextInt(5) + 1), null, new ItemStack(Itemss.stopWorm)));
}
 
Example #16
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public void readEntityFromNBT(NBTTagCompound compound) {
    super.readEntityFromNBT(compound);
    this.getDataManager().set(TOFUPROFESSION, compound.getInteger("tofu_profession"));
    //Load villager's CarrierLevel and make it usable as tofunian CareerLevel
    this.tofunianCareerLevel = compound.getInteger("CareerLevel");

    this.wealth = compound.getInteger("Riches");

    if (compound.hasKey("Offers", 10)) {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("Offers");
        this.buyingList = new MerchantRecipeList(nbttagcompound);
    }

    this.isWillingToMate = compound.getBoolean("Willing");

    NBTTagList nbttaglist = compound.getTagList("Inventory", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i) {
        ItemStack itemstack = new ItemStack(nbttaglist.getCompoundTagAt(i));

        if (!itemstack.isEmpty()) {
            this.villagerInventory.addItem(itemstack);
        }
    }

    this.setCanPickUpLoot(true);
    this.updateEntityAI();
}
 
Example #17
Source File: TofuVillages.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
    //Sell
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_material, 2 + random.nextInt(2))));
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_material, 8 + random.nextInt(4),2)));
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 6 + random.nextInt(4)), new ItemStack(ItemLoader.tofustick)));
}
 
Example #18
Source File: TofuVillages.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
    //Buy
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 18 + random.nextInt(4),2), new ItemStack(Items.EMERALD)));
    //Sell
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 17 + random.nextInt(8),3)));
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 10 + random.nextInt(4),4)));
    recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD), new ItemStack(ItemLoader.tofu_food, 12 + random.nextInt(4),5)));
}
 
Example #19
Source File: TofuVillages.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
    //Buy
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.soybeans, 18 + random.nextInt(4)), new ItemStack(Items.EMERALD)));
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.tofu_food, 14 + random.nextInt(4),1), new ItemStack(Items.EMERALD)));
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 6 + random.nextInt(4),5), new ItemStack(Items.EMERALD)));
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.material, 14 + random.nextInt(4),3), new ItemStack(Items.EMERALD)));
    //Sell
}
 
Example #20
Source File: CraftMerchantCustom.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public MerchantRecipeList getRecipes(EntityPlayer entityhuman) {
    return this.trades;
}
 
Example #21
Source File: EntityShopkeeper.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public MerchantRecipeList getRecipes(EntityPlayer player) {
	return createTradesBaseOnRep(player);
}
 
Example #22
Source File: MerchantRecipes.java    From HoloInventory with MIT License 4 votes vote down vote up
@Override
public IMessage onMessage(MerchantRecipes message, MessageContext ctx)
{
    ResponseMessage.handle(message, new MerchantRenderer(message.name, new MerchantRecipeList(message.tag)));
    return null;
}
 
Example #23
Source File: MerchantRenderer.java    From HoloInventory with MIT License 4 votes vote down vote up
public MerchantRenderer(String name, MerchantRecipeList input)
{
    this.name = I18n.format(name);
    this.recipes = input;
}
 
Example #24
Source File: CraftMerchantCustom.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void setRecipes(@Nullable MerchantRecipeList recipeList) {

}
 
Example #25
Source File: VillagerTofu1.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random)
{
	int i = price != null ? price.getPrice(random) : 1;
	recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, i, 0),item.copy()));
      }
 
Example #26
Source File: VillagerLoader.java    From Sakura_mod with MIT License 4 votes vote down vote up
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random)
{
	int i = price != null ? price.getPrice(random) : 1;
	recipeList.add(new MerchantRecipe(item.copy(),new ItemStack(ItemLoader.MATERIAL, i, 50)));
      }
 
Example #27
Source File: VillagerLoader.java    From Sakura_mod with MIT License 4 votes vote down vote up
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random)
{
	int i = price != null ? price.getPrice(random) : 1;
	recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.MATERIAL, i, 50),item.copy()));
      }
 
Example #28
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 4 votes vote down vote up
private MerchantRecipeList settingTrade(int level) {
    MerchantRecipeList list = new MerchantRecipeList();

    if (getTofuProfession() == TofuProfession.FISHERMAN) {


        addTradeRubyForItem(list, new ItemStack(ItemLoader.tofu_food), 22 + rand.nextInt(6));

        addTradeForSingleRuby(list, new ItemStack(ItemLoader.foodset, 8 + rand.nextInt(3)), 1);
        if (tofunianCareerLevel > 1) {
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.soymilk_drink, 1, 1 + rand.nextInt(2)), 3 + rand.nextInt(2));
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.soymilk_drink, 1, 5 + rand.nextInt(2)), 3 + rand.nextInt(2));
        }
    } else if (getTofuProfession() == TofuProfession.TOFUCOOK) {
        addTradeRubyForItem(list, new ItemStack(ItemLoader.tofu_food), 24 + rand.nextInt(6));
        addTradeRubyForItem(list, new ItemStack(ItemLoader.soybeans), 24 + rand.nextInt(6));

        if (tofunianCareerLevel > 1) {
            addTradeRubyForItem(list, new ItemStack(ItemLoader.rice), 16 + rand.nextInt(6));

            addTradeForSingleRuby(list, new ItemStack(ItemLoader.tofu_food, 6 + rand.nextInt(4), 6), 1);
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.tofu_food, 6 + rand.nextInt(4), 5), 1);
        }
        if (tofunianCareerLevel > 2) {
            if (this.rand.nextInt(2) == 0) {
                addTradeForSingleRuby(list, new ItemStack(ItemLoader.foodset, 5 + rand.nextInt(3), 15), 1);
            } else {
                addTradeForSingleRuby(list, new ItemStack(ItemLoader.foodset, 6 + rand.nextInt(4), 14), 1);
            }
        }

        if (tofunianCareerLevel > 3) {
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.tofuhoe, 1), 4);
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.zundaMochi, 4 + rand.nextInt(4)), 1);

            addTradeForSingleRuby(list, new ItemStack(ItemLoader.material, 2 + rand.nextInt(2), 17), 4);
        }

        if (tofunianCareerLevel > 4) {
            if (this.rand.nextInt(2) == 0) {
                addTradeForSingleRuby(list, new ItemStack(ItemLoader.material, 1 + rand.nextInt(2), 9), 5);
            }
        }
    } else if (getTofuProfession() == TofuProfession.TOFUSMITH) {
        addTradeRubyForItem(list, new ItemStack(ItemLoader.tofu_food, 1, 2), 22 + rand.nextInt(6));

        addTradeForSingleRuby(list, new ItemStack(ItemLoader.metalTofuSword, 1), 4 + rand.nextInt(3));
        addTradeForSingleRuby(list, new ItemStack(ItemLoader.metalTofuShovel, 1), 5 + rand.nextInt(3));
        if (tofunianCareerLevel > 1) {
            addTradeRubyForItem(list, new ItemStack(ItemLoader.tofu_material, 1), 5 + rand.nextInt(4));
            addTradeForSingleRuby(list, new ItemStack(ItemLoader.metalhelmet, 1), 4 + rand.nextInt(3));
            addEnchantTradeForSingleRuby(list, new ItemStack(ItemLoader.metalTofuPickaxe, 1), 6 + rand.nextInt(6));
        }

        if (tofunianCareerLevel > 2) {
            addEnchantTradeForSingleRuby(list, new ItemStack(ItemLoader.metalleggins, 1), 6 + rand.nextInt(4));
            addEnchantTradeForSingleRuby(list, new ItemStack(ItemLoader.metalchestplate, 1), 7 + rand.nextInt(4));
        }

        if (tofunianCareerLevel > 3) {
            addEnchantTradeForSingleRuby(list, new ItemStack(ItemLoader.zundaBow, 1), 2 + rand.nextInt(2));
            addEnchantTradeForSingleRuby(list, new ItemStack(ItemLoader.zundaArrow, 8 + rand.nextInt(4)), 1 + rand.nextInt(1));
        }

        addTradeForSingleRuby(list, new ItemStack(ItemLoader.tofustick, 2), 1 + rand.nextInt(2));
    }

    return list;
}
 
Example #29
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
public void setRecipes(@Nullable MerchantRecipeList recipeList) {
}
 
Example #30
Source File: TofuVillages.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
    //Buy
    recipeList.add(new MerchantRecipe(new ItemStack(ItemLoader.rice, 16 + random.nextInt(8)), new ItemStack(Items.EMERALD)));
}