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


Java PotionEffect.getPotionID方法代码示例

本文整理汇总了Java中net.minecraft.potion.PotionEffect.getPotionID方法的典型用法代码示例。如果您正苦于以下问题:Java PotionEffect.getPotionID方法的具体用法?Java PotionEffect.getPotionID怎么用?Java PotionEffect.getPotionID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.potion.PotionEffect的用法示例。


在下文中一共展示了PotionEffect.getPotionID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: S1DPacketEntityEffect

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = (byte)(effect.getPotionID() & 255);
    this.amplifier = (byte)(effect.getAmplifier() & 255);

    if (effect.getDuration() > 32767)
    {
        this.duration = 32767;
    }
    else
    {
        this.duration = effect.getDuration();
    }

    this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:S1DPacketEntityEffect.java

示例2: getPotionFromInventory

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
private int getPotionFromInventory() {
    int pot = -1;
    int counter = 0;
    int i = 1;
    while (i < 45) {
        ItemStack is;
        ItemPotion potion;
        Item item;
        if (this.mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() && (item = (is = this.mc.thePlayer.inventoryContainer.getSlot(i).getStack()).getItem()) instanceof ItemPotion && (potion = (ItemPotion)item).getEffects(is) != null) {
            for (Object o : potion.getEffects(is)) {
                PotionEffect effect = (PotionEffect)o;
                if (effect.getPotionID() != Potion.heal.id || !ItemPotion.isSplash((int)is.getItemDamage())) continue;
                ++counter;
                pot = i;
            }
        }
        ++i;
    }
    Character colorFormatCharacter = new Character('\u00a7');
    this.suffix = OptionManager.getOption((String)"Hyphen", (Module)ModuleManager.getModule(HUD.class)).value ? colorFormatCharacter + "7 - " + counter : colorFormatCharacter + "7 " + counter;
    return pot;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:AutoPot.java

示例3: isPotionApplicable

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
    if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
    {
        int i = potioneffectIn.getPotionID();

        if (i == Potion.regeneration.id || i == Potion.poison.id)
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:EntityLivingBase.java

示例4: getColorFromItemStack

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
	PotionEffect effect = getEffect(stack);
	if (effect == null || effect.getPotionID() < 0 || effect.getPotionID() >= Potion.potionTypes.length)
		return super.getColorFromItemStack(stack, pass);
	return pass == 0 ? Potion.potionTypes[effect.getPotionID()].getLiquidColor() : super.getColorFromItemStack(stack, pass);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:9,代码来源:TippedArrow.java

示例5: onImpact

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Called when this EntityThrowable hits a block or entity.
 */
protected void onImpact(MovingObjectPosition p_70184_1_)
{
    if (!this.worldObj.isRemote)
    {
        List<PotionEffect> list = Items.potionitem.getEffects(this.potionDamage);

        if (list != null && !list.isEmpty())
        {
            AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D);
            List<EntityLivingBase> list1 = this.worldObj.<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);

            if (!list1.isEmpty())
            {
                for (EntityLivingBase entitylivingbase : list1)
                {
                    double d0 = this.getDistanceSqToEntity(entitylivingbase);

                    if (d0 < 16.0D)
                    {
                        double d1 = 1.0D - Math.sqrt(d0) / 4.0D;

                        if (entitylivingbase == p_70184_1_.entityHit)
                        {
                            d1 = 1.0D;
                        }

                        for (PotionEffect potioneffect : list)
                        {
                            int i = potioneffect.getPotionID();

                            if (Potion.potionTypes[i].isInstant())
                            {
                                Potion.potionTypes[i].affectEntity(this, this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1);
                            }
                            else
                            {
                                int j = (int)(d1 * (double)potioneffect.getDuration() + 0.5D);

                                if (j > 20)
                                {
                                    entitylivingbase.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier()));
                                }
                            }
                        }
                    }
                }
            }
        }

        this.worldObj.playAuxSFX(2002, new BlockPos(this), this.getPotionDamage());
        this.setDead();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:57,代码来源:EntityPotion.java

示例6: isPotionApplicable

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
    return potioneffectIn.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(potioneffectIn);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:EntitySpider.java

示例7: S1EPacketRemoveEntityEffect

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
public S1EPacketRemoveEntityEffect(int entityIdIn, PotionEffect effect)
{
    this.entityId = entityIdIn;
    this.effectId = effect.getPotionID();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:S1EPacketRemoveEntityEffect.java

示例8: addInformation

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isComplex) {
	if (stack.getItemDamage() == 0)
		return;

	List<PotionEffect> effects = getEffects(stack);
	HashMultimap<String, AttributeModifier> attributes = HashMultimap.create();

	if (effects == null || effects.isEmpty()) {
		String s = StatCollector.translateToLocal("potion.empty").trim();
		list.add(EnumChatFormatting.GRAY + s);
	} else
		for (PotionEffect potioneffect : effects) {
			String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim();
			Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
			Map<IAttribute, AttributeModifier> map = potion.func_111186_k();

			if (map != null && map.size() > 0)
				for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
					AttributeModifier attributemodifier = entry.getValue();
					AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
					attributes.put(entry.getKey().getAttributeUnlocalizedName(), attributemodifier1);
				}

			if (potioneffect.getAmplifier() > 0)
				s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
			if (potioneffect.getDuration() > 20)
				s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")";

			if (potion.isBadEffect())
				list.add(EnumChatFormatting.RED + s1);
			else
				list.add(EnumChatFormatting.GRAY + s1);
		}

	if (!attributes.isEmpty()) {
		list.add("");
		list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank"));

		for (Entry<String, AttributeModifier> entry1 : attributes.entries()) {
			AttributeModifier attributemodifier2 = entry1.getValue();
			double d0 = attributemodifier2.getAmount();
			double d1;

			if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
				d1 = attributemodifier2.getAmount();
			else
				d1 = attributemodifier2.getAmount() * 100.0D;

			if (d0 > 0.0D)
				list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			else if (d0 < 0.0D) {
				d1 *= -1.0D;
				list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			}
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:61,代码来源:LingeringPotion.java

示例9: drawActivePotionEffects

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
/**
 * Display the potion effects list
 */
private void drawActivePotionEffects()
{
    int i = this.guiLeft - 124;
    int j = this.guiTop;
    int k = 166;
    Collection<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffects();

    if (!collection.isEmpty())
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableLighting();
        int l = 33;

        if (collection.size() > 5)
        {
            l = 132 / (collection.size() - 1);
        }

        for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects())
        {
            Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.getTextureManager().bindTexture(inventoryBackground);
            this.drawTexturedModalRect(i, j, 0, 166, 140, 32);

            if (potion.hasStatusIcon())
            {
                int i1 = potion.getStatusIconIndex();
                this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
            }

            String s1 = I18n.format(potion.getName(), new Object[0]);

            if (potioneffect.getAmplifier() == 1)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 2)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 3)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]);
            }

            this.fontRendererObj.drawStringWithShadow(s1, (float)(i + 10 + 18), (float)(j + 6), 16777215);
            String s = Potion.getDurationString(potioneffect);
            this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
            j += l;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:57,代码来源:InventoryEffectRenderer.java


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