當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。