本文整理匯總了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");
}
示例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);
}
示例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;
}
示例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_);
}
示例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);
}
示例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);
}