當前位置: 首頁>>代碼示例>>Java>>正文


Java MerchantRecipeList.add方法代碼示例

本文整理匯總了Java中net.minecraft.village.MerchantRecipeList.add方法的典型用法代碼示例。如果您正苦於以下問題:Java MerchantRecipeList.add方法的具體用法?Java MerchantRecipeList.add怎麽用?Java MerchantRecipeList.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.village.MerchantRecipeList的用法示例。


在下文中一共展示了MerchantRecipeList.add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: modifyMerchantRecipeList

import net.minecraft.village.MerchantRecipeList; //導入方法依賴的package包/類
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)
{
    int i = 1;

    if (this.field_179409_b != null)
    {
        i = this.field_179409_b.getPrice(random);
    }

    int j = 1;

    if (this.field_179408_d != null)
    {
        j = this.field_179408_d.getPrice(random);
    }

    recipeList.add(new MerchantRecipe(new ItemStack(this.field_179411_a.getItem(), i, this.field_179411_a.getMetadata()), new ItemStack(Items.emerald), new ItemStack(this.field_179410_c.getItem(), j, this.field_179410_c.getMetadata())));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:EntityVillager.java

示例2: modifyMerchantRecipeList

import net.minecraft.village.MerchantRecipeList; //導入方法依賴的package包/類
/**
 * Affects the given MerchantRecipeList to possibly add or remove MerchantRecipes.
 */
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)
{
    int i = 1;

    if (this.buyingPriceInfo != null)
    {
        i = this.buyingPriceInfo.getPrice(random);
    }

    int j = 1;

    if (this.sellingPriceInfo != null)
    {
        j = this.sellingPriceInfo.getPrice(random);
    }

    recipeList.add(new MerchantRecipe(new ItemStack(this.buyingItemStack.getItem(), i, this.buyingItemStack.getMetadata()), new ItemStack(Items.EMERALD), new ItemStack(this.sellingItemstack.getItem(), j, this.sellingItemstack.getMetadata())));
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:EntityVillager.java

示例3: func_190888_a

import net.minecraft.village.MerchantRecipeList; //導入方法依賴的package包/類
public void func_190888_a(IMerchant p_190888_1_, MerchantRecipeList p_190888_2_, Random p_190888_3_)
{
    Enchantment enchantment = (Enchantment)Enchantment.REGISTRY.getRandomObject(p_190888_3_);
    int i = MathHelper.getInt(p_190888_3_, enchantment.getMinLevel(), enchantment.getMaxLevel());
    ItemStack itemstack = Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(enchantment, i));
    int j = 2 + p_190888_3_.nextInt(5 + i * 10) + 3 * i;

    if (enchantment.isTreasureEnchantment())
    {
        j *= 2;
    }

    if (j > 64)
    {
        j = 64;
    }

    p_190888_2_.add(new MerchantRecipe(new ItemStack(Items.BOOK), new ItemStack(Items.EMERALD, j), itemstack));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:EntityVillager.java

示例4: addMerchantRecipe

import net.minecraft.village.MerchantRecipeList; //導入方法依賴的package包/類
@Override
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random)
{
	int buyingPrice = this.buyingPriceInfo.getPrice(random);
	int sellingPrice = this.sellingPriceInfo.getPrice(random);

	ItemStack buying = buyingItemStack.copy();
	buying.setCount(buyingPrice);

	ItemStack selling = sellingItemStack.copy();
	selling.setCount(sellingPrice);

	MerchantRecipe tradeRecipe = new MerchantRecipe(buying, selling);
	recipeList.add(tradeRecipe);
}
 
開發者ID:DarkMorford,項目名稱:BetterThanWeagles,代碼行數:16,代碼來源:VillagerTradeItemForItem.java

示例5: manipulateTradesForVillager

import net.minecraft.village.MerchantRecipeList; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
	for(int i = 0; i < random.nextInt(3) + 2; i++) {
		int r = random.nextInt(18);
		switch(r) {
		case 0:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.CopperIngot, 2), new ItemStack(TechnicalItem.TinIngot, 1)));
			break;
		case 1:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.CopperIngot, 2), new ItemStack(TechnicalItem.ZincIngot, 1)));
			break;
		case 2:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.IronIngot, 2), new ItemStack(TechnicalItem.AluminiumIngot, 1)));
			break;
		case 3:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.IronIngot, 2), new ItemStack(TechnicalItem.CopperIngot, 1)));
			break;
		case 4:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.IronIngot, 2), new ItemStack(TechnicalItem.SilverIngot, 1)));
			break;
		case 5:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.SilverIngot, 2), new ItemStack(TechnicalItem.GoldIngot, 1)));
			break;
		case 6:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.GoldIngot, 1), new ItemStack(TechnicalItem.IronIngot, 2)));
			break;
		case 7:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.MolybdenumIngot, 2), new ItemStack(TechnicalItem.ManganeseIngot, 1)));
			break;
		case 8:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.MolybdenumIngot, 2), new ItemStack(TechnicalItem.TitaniumIngot, 1)));
			break;
		case 9:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.MolybdenumIngot, 2), new ItemStack(TechnicalItem.NiobiumIngot, 1)));
			break;
		case 10:
			recipeList.add(new MerchantRecipe(new ItemStack(TechnicalItem.MolybdenumIngot, 2), new ItemStack(TechnicalItem.TantalumIngot, 1)));
			break;
		}
	}
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:43,代碼來源:TradeHandler.java


注:本文中的net.minecraft.village.MerchantRecipeList.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。