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


Java PotionHelper.applyIngredient方法代碼示例

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


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

示例1: genPotionLevels

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
public static void genPotionLevels() {
    XUHelper.resetTimer();
    final HashSet<Item> ingredientIDs = new HashSet<Item>();
    final List<Integer> potionIDs = new ArrayList<Integer>();
    for (final Object anItemRegistry : Item.itemRegistry) {
        final Item i = (Item)anItemRegistry;
        for (int num = getMaxMeta(i), meta = 0; meta < num; ++meta) {
            if (i.isPotionIngredient(new ItemStack(i, 1, meta))) {
                ingredientIDs.add(i);
            }
        }
    }
    TileEntityGeneratorPotion.powerMap.put(0, 0);
    potionIDs.add(0);
    for (int j = 0; j < potionIDs.size(); ++j) {
        final int potion = potionIDs.get(j);
        for (final Item ingredient : ingredientIDs) {
            String k = "";
            String s = "";
            for (int num2 = getMaxMeta(ingredient), meta2 = 0; meta2 < num2 || !k.equals(s); ++meta2) {
                if (ingredient.isPotionIngredient(new ItemStack(ingredient, 1, meta2))) {
                    try {
                        s = ingredient.getPotionEffect(new ItemStack(ingredient, 1, meta2));
                        final int c = PotionHelper.applyIngredient(potion, s);
                        if (!potionIDs.contains(c)) {
                            potionIDs.add(c);
                            TileEntityGeneratorPotion.powerMap.put(c, TileEntityGeneratorPotion.powerMap.get(potion) + 1);
                        }
                        k = ((s == null) ? "" : s);
                    }
                    catch (Exception err) {
                        throw new RuntimeException("Caught error while applying potion ingredient " + ingredient.toString() + " to " + potion, err);
                    }
                }
            }
        }
    }
    XUHelper.printTimer("Potion generation");
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:40,代碼來源:TileEntityGeneratorPotion.java

示例2: getPotionResult

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
/**
 * The result of brewing a potion of the specified damage value with an ingredient itemstack.
 */
private int getPotionResult(int meta, ItemStack stack)
{
    return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:TileEntityBrewingStand.java

示例3: applyIngredient

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
private int applyIngredient(int meta, ItemStack stack) {
	return stack == null ? meta : stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta;
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:4,代碼來源:TileEntityNewBrewingStand.java

示例4: func_145936_c

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
private int func_145936_c(int p_145936_1_, ItemStack p_145936_2_)
{
    return p_145936_2_ == null ? p_145936_1_ : (p_145936_2_.getItem().isPotionIngredient(p_145936_2_) ? PotionHelper.applyIngredient(p_145936_1_, p_145936_2_.getItem().getPotionEffect(p_145936_2_)) : p_145936_1_);
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:5,代碼來源:TileEntityBrewingStand.java

示例5: getSecondPotionList

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
private int getSecondPotionList(int itemDamage, ItemStack stack)
{
    return stack == null ? itemDamage : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(itemDamage, stack.getItem().getPotionEffect(stack)) : itemDamage);
}
 
開發者ID:xbony2,項目名稱:Nuclear-Control,代碼行數:5,代碼來源:ItemVanillaMachineCard.java

示例6: getPotionResult

import net.minecraft.potion.PotionHelper; //導入方法依賴的package包/類
/**
 * The result of brewing a potion of the specified damage value with an ingredient itemstack.
 */
private int getPotionResult(int par1, ItemStack par2ItemStack)
{
    return par2ItemStack == null ? par1 : (Item.itemsList[par2ItemStack.itemID].isPotionIngredient() ? PotionHelper.applyIngredient(par1, Item.itemsList[par2ItemStack.itemID].getPotionEffect()) : par1);
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:8,代碼來源:TileEntityBrewingStand.java


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