net.minecraft.village.MerchantRecipe Java Examples

The following examples show how to use net.minecraft.village.MerchantRecipe. 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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #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: 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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
Source File: CraftMerchantCustom.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void useRecipe(MerchantRecipe merchantrecipe) {
    // increase recipe's uses
    merchantrecipe.incrementToolUses();
}
 
Example #16
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 #17
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 #18
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public void useRecipe(MerchantRecipe recipe) {

    recipe.incrementToolUses();
    this.livingSoundTime = -this.getTalkInterval();
    this.playSound(TofuSounds.TOFUNIAN_YES, this.getSoundVolume(), this.getSoundPitch());
    int i = 3 + this.rand.nextInt(4);

    if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0) {
        this.tofunianTimeUntilReset = 40;
        this.needsInitilization = true;
        this.isWillingToMate = true;

        //update TofunianTrade
        if (this.tofunianCareerLevel != 0) {

            ++this.tofunianCareerLevel;

        } else {

            this.tofunianCareerLevel = 2;

        }


        if (this.buyingPlayer != null) {
            this.lastBuyingPlayer = this.buyingPlayer.getUniqueID();
        } else {
            this.lastBuyingPlayer = null;
        }

        i += 5;
    }

    if (recipe.getItemToBuy().getItem() == ItemLoader.zundaruby) {
        this.wealth += recipe.getItemToBuy().getCount();
    }

    if (recipe.getRewardsExp()) {
        this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY + 0.5D, this.posZ, i));
    }

}
 
Example #19
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
protected void updateAITasks() {
    if (--this.randomTickDivider <= 0) {
        BlockPos blockpos = new BlockPos(this);

        String s = TofuVillageCollection.fileNameForProvider(this.world.provider);

        ((TofuVillageCollection) Objects.requireNonNull(this.world.getPerWorldStorage().getOrLoadData(TofuVillageCollection.class, s))).addToVillagerPositionList(blockpos);
        this.randomTickDivider = 70 + this.rand.nextInt(50);

        this.village = ((TofuVillageCollection) Objects.requireNonNull(this.world.getPerWorldStorage().getOrLoadData(TofuVillageCollection.class, s))).getNearestVillage(blockpos, 32);

        if (this.village == null) {
            this.detachHome();
        } else {
            BlockPos blockpos1 = this.village.getCenter();
            this.setHomePosAndDistance(blockpos1, this.village.getTofuVillageRadius());

            if (this.isLookingForHome) {
                this.isLookingForHome = false;
                this.village.setDefaultPlayerReputation(5);
            }
        }
    }

    if (!this.isTrading() && this.tofunianTimeUntilReset > 0) {
        --this.tofunianTimeUntilReset;

        if (this.tofunianTimeUntilReset <= 0) {
            if (this.needsInitilization) {
                for (MerchantRecipe merchantrecipe : this.buyingList) {
                    if (merchantrecipe.isRecipeDisabled()) {
                        merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
                    }
                }

                this.initTrades();
                this.needsInitilization = false;

                if (this.lastBuyingPlayer != null) {
                    this.world.setEntityState(this, (byte) 14);

                }
            }

            this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
        }
    }

    super.updateAITasks();
}
 
Example #20
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)));
}
 
Example #21
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(item.copy(),new ItemStack(Items.EMERALD, i, 0)));
      }
 
Example #22
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 3 votes vote down vote up
public void addEnchantTradeForSingleRuby(MerchantRecipeList list, ItemStack sell, int cost) {

        ItemStack stack1 = sell.copy();

        ItemStack enchantStack = EnchantmentHelper.addRandomEnchantment(this.rand, new ItemStack(stack1.getItem(), 1, stack1.getMetadata()), 5 + this.rand.nextInt(15), false);

        list.add(new MerchantRecipe(new ItemStack(ItemLoader.zundaruby, cost), enchantStack));
    }
 
Example #23
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 3 votes vote down vote up
public void addTradeRubyForItem(MerchantRecipeList list, ItemStack buy, int cost) {

        ItemStack stack1 = buy.copy();

        stack1.setCount(cost);

        list.add(new MerchantRecipe(stack1, new ItemStack(ItemLoader.zundaruby, 1)));
    }
 
Example #24
Source File: EntityTofunian.java    From TofuCraftReload with MIT License 2 votes vote down vote up
public void addTradeForSingleRuby(MerchantRecipeList list, ItemStack sell, int cost) {

        ItemStack stack1 = sell.copy();

        list.add(new MerchantRecipe(new ItemStack(ItemLoader.zundaruby, cost), stack1));
    }