当前位置: 首页>>代码示例>>Java>>正文


Java PotionHelper.getPotionEffects方法代码示例

本文整理汇总了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;
}
 
开发者ID:TheDaemoness,项目名称:IceAndShadow2,代码行数:17,代码来源:NyxItemPotion.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:34,代码来源:ItemPotion.java

示例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));
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:14,代码来源:TippedArrow.java

示例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;
    }
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:37,代码来源:itemPotion.java

示例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;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.8,代码行数:34,代码来源:ItemPotionRediscovered.java

示例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;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:37,代码来源:ItemPotion.java

示例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;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:34,代码来源:ItemPotion.java

示例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;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:32,代码来源:ItemPotion.java

示例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));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:60,代码来源:ItemPotion.java

示例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));
    }
}
 
开发者ID:jtrent238,项目名称:PopularMMOS-EpicProportions-Mod,代码行数:62,代码来源:itemPotion.java

示例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));
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:61,代码来源:ItemPotion.java

示例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));
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:59,代码来源:ItemPotion.java

示例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));
        }
    }
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:63,代码来源:ItemPotion.java


注:本文中的net.minecraft.potion.PotionHelper.getPotionEffects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。