本文整理汇总了Java中net.minecraft.potion.PotionHelper.getPotionEffects方法的典型用法代码示例。如果您正苦于以下问题:Java PotionHelper.getPotionEffects方法的具体用法?Java PotionHelper.getPotionEffects怎么用?Java PotionHelper.getPotionEffects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.potion.PotionHelper
的用法示例。
在下文中一共展示了PotionHelper.getPotionEffects方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertVanilla
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
public static int convertVanilla(int damage) {
final List l = PotionHelper.getPotionEffects(damage, false);
if (l != null && !l.isEmpty()) {
final PotionEffect p = (PotionEffect) l.get(0);
final Potion what = Potion.potionTypes[p.getPotionID()];
if ((what.isInstant() && p.getAmplifier() >= 1)
|| (p.getDuration() >= (int) (9600 * what.getEffectiveness()))) {
for (int i = 0; i < validPotions.size(); ++i) {
if (validPotions.get(i).id == what.id)
return freshEffect(i);
}
}
}
return -1;
}
示例2: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
public List<PotionEffect> getEffects(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
{
List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
list1.add(potioneffect);
}
}
return list1;
}
else
{
List<PotionEffect> list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata()));
if (list == null)
{
list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
}
return list;
}
}
示例3: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubItems(Item item, CreativeTabs tab, List list) {
List<ItemStack> potions = new ArrayList<ItemStack>();
ModItems.lingering_potion.getSubItems(ModItems.lingering_potion, tab, potions);
for (ItemStack potion : potions) {
List<PotionEffect> effects = PotionHelper.getPotionEffects(potion.getItemDamage(), false);
if (effects != null && !effects.isEmpty())
for (PotionEffect effect : effects)
list.add(setEffect(new ItemStack(this), Potion.potionTypes[effect.getPotionID()], effect.getDuration() / 2));
}
}
示例4: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* Returns a list of potion effects for the specified itemstack.
*/
public List getEffects(ItemStack p_77832_1_)
{
if (p_77832_1_.hasTagCompound() && p_77832_1_.getTagCompound().hasKey("CustomPotionEffects", 9))
{
ArrayList arraylist = new ArrayList();
NBTTagList nbttaglist = p_77832_1_.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
arraylist.add(potioneffect);
}
}
return arraylist;
}
else
{
List list = (List)this.effectCache.get(Integer.valueOf(p_77832_1_.getItemDamage()));
if (list == null)
{
list = PotionHelper.getPotionEffects(p_77832_1_.getItemDamage(), false);
this.effectCache.put(Integer.valueOf(p_77832_1_.getItemDamage()), list);
}
return list;
}
}
示例5: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
public List getEffects(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
{
ArrayList arraylist = Lists.newArrayList();
NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
arraylist.add(potioneffect);
}
}
return arraylist;
}
else
{
List list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata()));
if (list == null)
{
list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
}
return list;
}
}
示例6: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* Returns a list of potion effects for the specified itemstack.
*/
public List getEffects(ItemStack par1ItemStack)
{
if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().func_150297_b("CustomPotionEffects", 9))
{
ArrayList var7 = new ArrayList();
NBTTagList var3 = par1ItemStack.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int var4 = 0; var4 < var3.tagCount(); ++var4)
{
NBTTagCompound var5 = var3.getCompoundTagAt(var4);
PotionEffect var6 = PotionEffect.readCustomPotionEffectFromNBT(var5);
if (var6 != null)
{
var7.add(var6);
}
}
return var7;
}
else
{
List var2 = (List)this.effectCache.get(Integer.valueOf(par1ItemStack.getItemDamage()));
if (var2 == null)
{
var2 = PotionHelper.getPotionEffects(par1ItemStack.getItemDamage(), false);
this.effectCache.put(Integer.valueOf(par1ItemStack.getItemDamage()), var2);
}
return var2;
}
}
示例7: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
public List getEffects(ItemStack p_77832_1_)
{
if (p_77832_1_.hasTagCompound() && p_77832_1_.getTagCompound().hasKey("CustomPotionEffects", 9))
{
ArrayList arraylist = new ArrayList();
NBTTagList nbttaglist = p_77832_1_.getTagCompound().getTagList("CustomPotionEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
arraylist.add(potioneffect);
}
}
return arraylist;
}
else
{
List list = (List)this.effectCache.get(Integer.valueOf(p_77832_1_.getItemDamage()));
if (list == null)
{
list = PotionHelper.getPotionEffects(p_77832_1_.getItemDamage(), false);
this.effectCache.put(Integer.valueOf(p_77832_1_.getItemDamage()), list);
}
return list;
}
}
示例8: getEffects
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* Returns a list of potion effects for the specified itemstack.
*/
public List getEffects(ItemStack par1ItemStack)
{
if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("CustomPotionEffects"))
{
ArrayList arraylist = new ArrayList();
NBTTagList nbttaglist = par1ItemStack.getTagCompound().getTagList("CustomPotionEffects");
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = (NBTTagCompound)nbttaglist.tagAt(i);
arraylist.add(PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound));
}
return arraylist;
}
else
{
List list = (List)this.effectCache.get(Integer.valueOf(par1ItemStack.getItemDamage()));
if (list == null)
{
list = PotionHelper.getPotionEffects(par1ItemStack.getItemDamage(), false);
this.effectCache.put(Integer.valueOf(par1ItemStack.getItemDamage()), list);
}
return list;
}
}
示例9: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
super.getSubItems(itemIn, tab, subItems);
if (SUB_ITEMS_CACHE.isEmpty())
{
for (int i = 0; i <= 15; ++i)
{
for (int j = 0; j <= 1; ++j)
{
int lvt_6_1_;
if (j == 0)
{
lvt_6_1_ = i | 8192;
}
else
{
lvt_6_1_ = i | 16384;
}
for (int l = 0; l <= 2; ++l)
{
int i1 = lvt_6_1_;
if (l != 0)
{
if (l == 1)
{
i1 = lvt_6_1_ | 32;
}
else if (l == 2)
{
i1 = lvt_6_1_ | 64;
}
}
List<PotionEffect> list = PotionHelper.getPotionEffects(i1, false);
if (list != null && !list.isEmpty())
{
SUB_ITEMS_CACHE.put(list, Integer.valueOf(i1));
}
}
}
}
}
Iterator iterator = SUB_ITEMS_CACHE.values().iterator();
while (iterator.hasNext())
{
int j1 = ((Integer)iterator.next()).intValue();
subItems.add(new ItemStack(itemIn, 1, j1));
}
}
示例10: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
@SideOnly(Side.CLIENT)
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
{
super.getSubItems(p_150895_1_, p_150895_2_, p_150895_3_);
int j;
if (field_77835_b.isEmpty())
{
for (int i = 0; i <= 15; ++i)
{
for (j = 0; j <= 1; ++j)
{
int k;
if (j == 0)
{
k = i | 8192;
}
else
{
k = i | 16384;
}
for (int l = 0; l <= 2; ++l)
{
int i1 = k;
if (l != 0)
{
if (l == 1)
{
i1 = k | 32;
}
else if (l == 2)
{
i1 = k | 64;
}
}
List list1 = PotionHelper.getPotionEffects(i1, false);
if (list1 != null && !list1.isEmpty())
{
field_77835_b.put(list1, Integer.valueOf(i1));
}
}
}
}
}
Iterator iterator = field_77835_b.values().iterator();
while (iterator.hasNext())
{
j = ((Integer)iterator.next()).intValue();
p_150895_3_.add(new ItemStack(p_150895_1_, 1, j));
}
}
示例11: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
/**
* This returns the sub items
*/
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
{
super.getSubItems(p_150895_1_, p_150895_2_, p_150895_3_);
int var5;
if (field_77835_b.isEmpty())
{
for (int var4 = 0; var4 <= 15; ++var4)
{
for (var5 = 0; var5 <= 1; ++var5)
{
int var6;
if (var5 == 0)
{
var6 = var4 | 8192;
}
else
{
var6 = var4 | 16384;
}
for (int var7 = 0; var7 <= 2; ++var7)
{
int var8 = var6;
if (var7 != 0)
{
if (var7 == 1)
{
var8 = var6 | 32;
}
else if (var7 == 2)
{
var8 = var6 | 64;
}
}
List var9 = PotionHelper.getPotionEffects(var8, false);
if (var9 != null && !var9.isEmpty())
{
field_77835_b.put(var9, Integer.valueOf(var8));
}
}
}
}
}
Iterator var10 = field_77835_b.values().iterator();
while (var10.hasNext())
{
var5 = ((Integer)var10.next()).intValue();
p_150895_3_.add(new ItemStack(p_150895_1_, 1, var5));
}
}
示例12: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
{
super.getSubItems(p_150895_1_, p_150895_2_, p_150895_3_);
int j;
if (field_77835_b.isEmpty())
{
for (int i = 0; i <= 15; ++i)
{
for (j = 0; j <= 1; ++j)
{
int k;
if (j == 0)
{
k = i | 8192;
}
else
{
k = i | 16384;
}
for (int l = 0; l <= 2; ++l)
{
int i1 = k;
if (l != 0)
{
if (l == 1)
{
i1 = k | 32;
}
else if (l == 2)
{
i1 = k | 64;
}
}
List list1 = PotionHelper.getPotionEffects(i1, false);
if (list1 != null && !list1.isEmpty())
{
field_77835_b.put(list1, Integer.valueOf(i1));
}
}
}
}
}
Iterator iterator = field_77835_b.values().iterator();
while (iterator.hasNext())
{
j = ((Integer)iterator.next()).intValue();
p_150895_3_.add(new ItemStack(p_150895_1_, 1, j));
}
}
示例13: getSubItems
import net.minecraft.potion.PotionHelper; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
super.getSubItems(par1, par2CreativeTabs, par3List);
int j;
if (field_77835_b.isEmpty())
{
for (int k = 0; k <= 15; ++k)
{
for (j = 0; j <= 1; ++j)
{
int l;
if (j == 0)
{
l = k | 8192;
}
else
{
l = k | 16384;
}
for (int i1 = 0; i1 <= 2; ++i1)
{
int j1 = l;
if (i1 != 0)
{
if (i1 == 1)
{
j1 = l | 32;
}
else if (i1 == 2)
{
j1 = l | 64;
}
}
List list1 = PotionHelper.getPotionEffects(j1, false);
if (list1 != null && !list1.isEmpty())
{
field_77835_b.put(list1, Integer.valueOf(j1));
}
}
}
}
}
Iterator iterator = field_77835_b.values().iterator();
while (iterator.hasNext())
{
j = ((Integer)iterator.next()).intValue();
par3List.add(new ItemStack(par1, 1, j));
}
}