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


Java PotionTypes.EMPTY属性代码示例

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


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

示例1: addPotionToItemStack

public static ItemStack addPotionToItemStack(ItemStack itemIn, PotionType potionIn)
{
    ResourceLocation resourcelocation = (ResourceLocation)PotionType.REGISTRY.getNameForObject(potionIn);

    if (potionIn == PotionTypes.EMPTY)
    {
        if (itemIn.hasTagCompound())
        {
            NBTTagCompound nbttagcompound = itemIn.getTagCompound();
            nbttagcompound.removeTag("Potion");

            if (nbttagcompound.hasNoTags())
            {
                itemIn.setTagCompound((NBTTagCompound)null);
            }
        }
    }
    else
    {
        NBTTagCompound nbttagcompound1 = itemIn.hasTagCompound() ? itemIn.getTagCompound() : new NBTTagCompound();
        nbttagcompound1.setString("Potion", resourcelocation.toString());
        itemIn.setTagCompound(nbttagcompound1);
    }

    return itemIn;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:PotionUtils.java

示例2: setPotionEffect

public void setPotionEffect(ItemStack stack)
{
    if (stack.getItem() == Items.TIPPED_ARROW)
    {
        this.potion = PotionUtils.getPotionTypeFromNBT(stack.getTagCompound());
        Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack);

        if (!collection.isEmpty())
        {
            for (PotionEffect potioneffect : collection)
            {
                this.customPotionEffects.add(new PotionEffect(potioneffect));
            }
        }

        this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, collection))));
    }
    else if (stack.getItem() == Items.ARROW)
    {
        this.potion = PotionTypes.EMPTY;
        this.customPotionEffects.clear();
        this.dataManager.set(COLOR, Integer.valueOf(0));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:EntityTippedArrow.java

示例3: writeEntityToNBT

/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);

    if (this.potion != PotionTypes.EMPTY && this.potion != null)
    {
        compound.setString("Potion", ((ResourceLocation)PotionType.REGISTRY.getNameForObject(this.potion)).toString());
    }

    if (!this.customPotionEffects.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (PotionEffect potioneffect : this.customPotionEffects)
        {
            nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
        }

        compound.setTag("CustomPotionEffects", nbttaglist);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:EntityTippedArrow.java

示例4: readEntityFromNBT

/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    super.readEntityFromNBT(compound);

    if (compound.hasKey("Potion", 8))
    {
        this.potion = PotionUtils.getPotionTypeFromNBT(compound);
    }

    for (PotionEffect potioneffect : PotionUtils.getFullEffectsFromTag(compound))
    {
        this.addEffect(potioneffect);
    }

    if (this.potion != PotionTypes.EMPTY || !this.customPotionEffects.isEmpty())
    {
        this.dataManager.set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.customPotionEffects))));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:EntityTippedArrow.java

示例5: setPotion

public void setPotion(PotionType potionIn)
{
    this.potion = potionIn;

    if (!this.colorSet)
    {
        if (potionIn == PotionTypes.EMPTY && this.effects.isEmpty())
        {
            this.getDataManager().set(COLOR, Integer.valueOf(0));
        }
        else
        {
            this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(potionIn, this.effects))));
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:EntityAreaEffectCloud.java

示例6: getArrowStack

protected ItemStack getArrowStack()
{
    ItemStack dart = new ItemStack(ModItems.dart, 1, getType().getMetadata());
    if(potion !=PotionTypes.EMPTY){
    	PotionUtils.addPotionToItemStack(dart, this.potion);
        PotionUtils.appendEffects(dart, this.customPotionEffects);

        if (this.hasColor)
        {
            NBTTagCompound nbttagcompound = dart.getTagCompound();

            if (nbttagcompound == null)
            {
                nbttagcompound = new NBTTagCompound();
                dart.setTagCompound(nbttagcompound);
            }

            nbttagcompound.setInteger("CustomPotionColor", this.getColor());
        }
    }
    return dart;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:22,代码来源:EntityDart.java

示例7: setPotionEffect

public void setPotionEffect(ItemStack stack)
{
    if (stack.getItem() == Items.TIPPED_ARROW)
    {
        this.potion = PotionUtils.getPotionFromItem(stack);
        Collection<PotionEffect> collection = PotionUtils.getFullEffectsFromItem(stack);

        if (!collection.isEmpty())
        {
            for (PotionEffect potioneffect : collection)
            {
                this.customPotionEffects.add(new PotionEffect(potioneffect));
            }
        }

        int i = func_191508_b(stack);

        if (i == -1)
        {
            this.func_190548_o();
        }
        else
        {
            this.func_191507_d(i);
        }
    }
    else if (stack.getItem() == Items.ARROW)
    {
        this.potion = PotionTypes.EMPTY;
        this.customPotionEffects.clear();
        this.dataManager.set(COLOR, Integer.valueOf(-1));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:EntityTippedArrow.java

示例8: onUpdate

/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (this.world.isRemote)
    {
        if (this.inGround)
        {
            if (this.timeInGround % 5 == 0)
            {
                this.spawnPotionParticles(1);
            }
        }
        else
        {
            this.spawnPotionParticles(2);
        }
    }
    else if (this.inGround && this.timeInGround != 0 && !this.customPotionEffects.isEmpty() && this.timeInGround >= 600)
    {
        this.world.setEntityState(this, (byte)0);
        this.potion = PotionTypes.EMPTY;
        this.customPotionEffects.clear();
        this.dataManager.set(COLOR, Integer.valueOf(-1));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:EntityTippedArrow.java

示例9: writeEntityToNBT

/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);

    if (this.potion != PotionTypes.EMPTY && this.potion != null)
    {
        compound.setString("Potion", ((ResourceLocation)PotionType.REGISTRY.getNameForObject(this.potion)).toString());
    }

    if (this.field_191509_at)
    {
        compound.setInteger("Color", this.getColor());
    }

    if (!this.customPotionEffects.isEmpty())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (PotionEffect potioneffect : this.customPotionEffects)
        {
            nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound()));
        }

        compound.setTag("CustomPotionEffects", nbttaglist);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:EntityTippedArrow.java

示例10: EntityAreaEffectCloud

public EntityAreaEffectCloud(World worldIn)
{
    super(worldIn);
    this.potion = PotionTypes.EMPTY;
    this.effects = Lists.<PotionEffect>newArrayList();
    this.reapplicationDelayMap = Maps.<Entity, Integer>newHashMap();
    this.duration = 600;
    this.waitTime = 20;
    this.reapplicationDelay = 20;
    this.noClip = true;
    this.isImmuneToFire = true;
    this.setRadius(3.0F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:EntityAreaEffectCloud.java

示例11: func_190618_C

private void func_190618_C()
{
    if (this.potion == PotionTypes.EMPTY && this.effects.isEmpty())
    {
        this.getDataManager().set(COLOR, Integer.valueOf(0));
    }
    else
    {
        this.getDataManager().set(COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.effects))));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:EntityAreaEffectCloud.java

示例12: getSubItems

/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems)
{
    for (PotionType potiontype : PotionType.REGISTRY)
    {
        if (potiontype != PotionTypes.EMPTY)
        {
            subItems.add(PotionUtils.addPotionToItemStack(new ItemStack(itemIn), potiontype));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ItemPotion.java

示例13: func_190901_a

public ItemStack func_190901_a(EntityPlayer p_190901_1_, ItemStack p_190901_2_)
{
    PotionType potiontype = PotionUtils.getPotionFromItem(p_190901_2_);

    if (potiontype != PotionTypes.WATER && potiontype != PotionTypes.EMPTY)
    {
        this.player.addStat(AchievementList.POTION);
    }

    super.func_190901_a(p_190901_1_, p_190901_2_);
    return p_190901_2_;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:ContainerBrewingStand.java

示例14: onUpdate

/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (this.worldObj.isRemote)
    {
        if (this.inGround)
        {
            if (this.timeInGround % 5 == 0)
            {
                this.spawnPotionParticles(1);
            }
        }
        else
        {
            this.spawnPotionParticles(2);
        }
    }
    else if (this.inGround && this.timeInGround != 0 && !this.customPotionEffects.isEmpty() && this.timeInGround >= 600)
    {
        this.worldObj.setEntityState(this, (byte)0);
        this.potion = PotionTypes.EMPTY;
        this.customPotionEffects.clear();
        this.dataManager.set(COLOR, Integer.valueOf(0));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:EntityTippedArrow.java

示例15: getArrowStack

protected ItemStack getArrowStack()
{
    if (this.customPotionEffects.isEmpty() && this.potion == PotionTypes.EMPTY)
    {
        return new ItemStack(Items.ARROW);
    }
    else
    {
        ItemStack itemstack = new ItemStack(Items.TIPPED_ARROW);
        PotionUtils.addPotionToItemStack(itemstack, this.potion);
        PotionUtils.appendEffects(itemstack, this.customPotionEffects);
        return itemstack;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:EntityTippedArrow.java


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