本文整理匯總了Java中net.minecraft.init.MobEffects.POISON屬性的典型用法代碼示例。如果您正苦於以下問題:Java MobEffects.POISON屬性的具體用法?Java MobEffects.POISON怎麽用?Java MobEffects.POISON使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類net.minecraft.init.MobEffects
的用法示例。
在下文中一共展示了MobEffects.POISON屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: isPotionApplicable
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn);
}
示例4: 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));
}
}
示例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.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));
}
}