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


Java PotionEffect.onUpdate方法代码示例

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


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

示例1: updatePotionEffects

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
    Iterator<Integer> iterator = this.activePotionsMap.keySet().iterator();

    while (iterator.hasNext())
    {
        Integer integer = (Integer)iterator.next();
        PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(integer);

        if (!potioneffect.onUpdate(this))
        {
            if (!this.worldObj.isRemote)
            {
                iterator.remove();
                this.onFinishedPotionEffect(potioneffect);
            }
        }
        else if (potioneffect.getDuration() % 600 == 0)
        {
            this.onChangedPotionEffect(potioneffect, false);
        }
    }

    if (this.potionsNeedUpdate)
    {
        if (!this.worldObj.isRemote)
        {
            this.updatePotionMetadata();
        }

        this.potionsNeedUpdate = false;
    }

    int i = this.dataWatcher.getWatchableObjectInt(7);
    boolean flag1 = this.dataWatcher.getWatchableObjectByte(8) > 0;

    if (i > 0)
    {
        boolean flag = false;

        if (!this.isInvisible())
        {
            flag = this.rand.nextBoolean();
        }
        else
        {
            flag = this.rand.nextInt(15) == 0;
        }

        if (flag1)
        {
            flag &= this.rand.nextInt(5) == 0;
        }

        if (flag && i > 0)
        {
            double d0 = (double)(i >> 16 & 255) / 255.0D;
            double d1 = (double)(i >> 8 & 255) / 255.0D;
            double d2 = (double)(i >> 0 & 255) / 255.0D;
            this.worldObj.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:64,代码来源:EntityLivingBase.java

示例2: updatePotionEffects

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
    Iterator<Potion> iterator = this.activePotionsMap.keySet().iterator();

    try
    {
        while (iterator.hasNext())
        {
            Potion potion = (Potion)iterator.next();
            PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(potion);

            if (!potioneffect.onUpdate(this))
            {
                if (!this.world.isRemote)
                {
                    iterator.remove();
                    this.onFinishedPotionEffect(potioneffect);
                }
            }
            else if (potioneffect.getDuration() % 600 == 0)
            {
                this.onChangedPotionEffect(potioneffect, false);
            }
        }
    }
    catch (ConcurrentModificationException var11)
    {
        ;
    }

    if (this.potionsNeedUpdate)
    {
        if (!this.world.isRemote)
        {
            this.updatePotionMetadata();
        }

        this.potionsNeedUpdate = false;
    }

    int i = ((Integer)this.dataManager.get(POTION_EFFECTS)).intValue();
    boolean flag1 = ((Boolean)this.dataManager.get(HIDE_PARTICLES)).booleanValue();

    if (i > 0)
    {
        boolean flag;

        if (this.isInvisible())
        {
            flag = this.rand.nextInt(15) == 0;
        }
        else
        {
            flag = this.rand.nextBoolean();
        }

        if (flag1)
        {
            flag &= this.rand.nextInt(5) == 0;
        }

        if (flag && i > 0)
        {
            double d0 = (double)(i >> 16 & 255) / 255.0D;
            double d1 = (double)(i >> 8 & 255) / 255.0D;
            double d2 = (double)(i >> 0 & 255) / 255.0D;
            this.world.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:71,代码来源:EntityLivingBase.java

示例3: updatePotionEffects

import net.minecraft.potion.PotionEffect; //导入方法依赖的package包/类
protected void updatePotionEffects()
{
    Iterator<Potion> iterator = this.activePotionsMap.keySet().iterator();

    while (iterator.hasNext())
    {
        Potion potion = (Potion)iterator.next();
        PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(potion);

        if (!potioneffect.onUpdate(this))
        {
            if (!this.worldObj.isRemote)
            {
                iterator.remove();
                this.onFinishedPotionEffect(potioneffect);
            }
        }
        else if (potioneffect.getDuration() % 600 == 0)
        {
            this.onChangedPotionEffect(potioneffect, false);
        }
    }

    if (this.potionsNeedUpdate)
    {
        if (!this.worldObj.isRemote)
        {
            this.updatePotionMetadata();
        }

        this.potionsNeedUpdate = false;
    }

    int i = ((Integer)this.dataManager.get(POTION_EFFECTS)).intValue();
    boolean flag1 = ((Boolean)this.dataManager.get(HIDE_PARTICLES)).booleanValue();

    if (i > 0)
    {
        boolean flag;

        if (this.isInvisible())
        {
            flag = this.rand.nextInt(15) == 0;
        }
        else
        {
            flag = this.rand.nextBoolean();
        }

        if (flag1)
        {
            flag &= this.rand.nextInt(5) == 0;
        }

        if (flag && i > 0)
        {
            double d0 = (double)(i >> 16 & 255) / 255.0D;
            double d1 = (double)(i >> 8 & 255) / 255.0D;
            double d2 = (double)(i >> 0 & 255) / 255.0D;
            this.worldObj.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:64,代码来源:EntityLivingBase.java


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