当前位置: 首页>>代码示例>>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;未经允许,请勿转载。