當前位置: 首頁>>代碼示例>>Java>>正文


Java MobEffects.REGENERATION屬性代碼示例

本文整理匯總了Java中net.minecraft.init.MobEffects.REGENERATION屬性的典型用法代碼示例。如果您正苦於以下問題:Java MobEffects.REGENERATION屬性的具體用法?Java MobEffects.REGENERATION怎麽用?Java MobEffects.REGENERATION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.init.MobEffects的用法示例。


在下文中一共展示了MobEffects.REGENERATION屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setRandomEffect

public void setRandomEffect(Random rand)
{
    int i = rand.nextInt(5);

    if (i <= 1)
    {
        this.effect = MobEffects.SPEED;
    }
    else if (i <= 2)
    {
        this.effect = MobEffects.STRENGTH;
    }
    else if (i <= 3)
    {
        this.effect = MobEffects.REGENERATION;
    }
    else if (i <= 4)
    {
        this.effect = MobEffects.INVISIBILITY;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:EntitySpider.java

示例2: isReady

/**
 * checks if Potion effect is ready to be applied this tick.
 */
public boolean isReady(int duration, int amplifier)
{
    if (this == MobEffects.REGENERATION)
    {
        int k = 50 >> amplifier;
        return k > 0 ? duration % k == 0 : true;
    }
    else if (this == MobEffects.POISON)
    {
        int j = 25 >> amplifier;
        return j > 0 ? duration % j == 0 : true;
    }
    else if (this == MobEffects.WITHER)
    {
        int i = 40 >> amplifier;
        return i > 0 ? duration % i == 0 : true;
    }
    else
    {
        return this == MobEffects.HUNGER;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:Potion.java

示例3: isPotionApplicable

public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
    if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
    {
        Potion potion = potioneffectIn.getPotion();

        if (potion == MobEffects.REGENERATION || potion == MobEffects.POISON)
        {
            return false;
        }
    }

    return true;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:EntityLivingBase.java

示例4: drawButtonForegroundLayer

public void drawButtonForegroundLayer(int mouseX, int mouseY)
{
    String s = I18n.format(this.effect.getName(), new Object[0]);

    if (this.tier >= 3 && this.effect != MobEffects.REGENERATION)
    {
        s = s + " II";
    }

    GuiBeacon.this.drawCreativeTabHoveringText(s, mouseX, mouseY);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:GuiBeacon.java

示例5: performEffect

public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
{
    if (this == MobEffects.REGENERATION)
    {
        if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth())
        {
            entityLivingBaseIn.heal(1.0F);
        }
    }
    else if (this == MobEffects.POISON)
    {
        if (entityLivingBaseIn.getHealth() > 1.0F)
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F);
        }
    }
    else if (this == MobEffects.WITHER)
    {
        entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F);
    }
    else if (this == MobEffects.HUNGER && entityLivingBaseIn instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.005F * (float)(p_76394_2_ + 1));
    }
    else if (this == MobEffects.SATURATION && entityLivingBaseIn instanceof EntityPlayer)
    {
        if (!entityLivingBaseIn.world.isRemote)
        {
            ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F);
        }
    }
    else if ((this != MobEffects.INSTANT_HEALTH || entityLivingBaseIn.isEntityUndead()) && (this != MobEffects.INSTANT_DAMAGE || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this == MobEffects.INSTANT_DAMAGE && !entityLivingBaseIn.isEntityUndead() || this == MobEffects.INSTANT_HEALTH && entityLivingBaseIn.isEntityUndead())
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_));
        }
    }
    else
    {
        entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0));
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:43,代碼來源:Potion.java

示例6: performEffect

public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_)
{
    if (this == MobEffects.REGENERATION)
    {
        if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth())
        {
            entityLivingBaseIn.heal(1.0F);
        }
    }
    else if (this == MobEffects.POISON)
    {
        if (entityLivingBaseIn.getHealth() > 1.0F)
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F);
        }
    }
    else if (this == MobEffects.WITHER)
    {
        entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F);
    }
    else if (this == MobEffects.HUNGER && entityLivingBaseIn instanceof EntityPlayer)
    {
        ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.025F * (float)(p_76394_2_ + 1));
    }
    else if (this == MobEffects.SATURATION && entityLivingBaseIn instanceof EntityPlayer)
    {
        if (!entityLivingBaseIn.worldObj.isRemote)
        {
            ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F);
        }
    }
    else if ((this != MobEffects.INSTANT_HEALTH || entityLivingBaseIn.isEntityUndead()) && (this != MobEffects.INSTANT_DAMAGE || !entityLivingBaseIn.isEntityUndead()))
    {
        if (this == MobEffects.INSTANT_DAMAGE && !entityLivingBaseIn.isEntityUndead() || this == MobEffects.INSTANT_HEALTH && entityLivingBaseIn.isEntityUndead())
        {
            entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_));
        }
    }
    else
    {
        entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0));
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:43,代碼來源:Potion.java


注:本文中的net.minecraft.init.MobEffects.REGENERATION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。