本文整理汇总了Java中net.minecraft.util.DamageSource.isMagicDamage方法的典型用法代码示例。如果您正苦于以下问题:Java DamageSource.isMagicDamage方法的具体用法?Java DamageSource.isMagicDamage怎么用?Java DamageSource.isMagicDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.DamageSource
的用法示例。
在下文中一共展示了DamageSource.isMagicDamage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyPotionDamageCalculations
import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
* Reduces damage, depending on potions
*/
protected float applyPotionDamageCalculations(DamageSource source, float damage)
{
damage = super.applyPotionDamageCalculations(source, damage);
if (source.getEntity() == this)
{
damage = 0.0F;
}
if (source.isMagicDamage())
{
damage = (float)((double)damage * 0.15D);
}
return damage;
}
示例2: attackEntityFrom
import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (!this.func_175472_n() && !source.isMagicDamage() && source.getSourceOfDamage() instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)source.getSourceOfDamage();
if (!source.isExplosion())
{
entitylivingbase.attackEntityFrom(DamageSource.causeThornsDamage(this), 2.0F);
entitylivingbase.playSound("damage.thorns", 0.5F, 1.0F);
}
}
this.wander.makeUpdate();
return super.attackEntityFrom(source, amount);
}
示例3: attackEntityFrom
import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (!this.isMoving() && !source.isMagicDamage() && source.getSourceOfDamage() instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)source.getSourceOfDamage();
if (!source.isExplosion())
{
entitylivingbase.attackEntityFrom(DamageSource.causeThornsDamage(this), 2.0F);
}
}
if (this.wander != null)
{
this.wander.makeUpdate();
}
return super.attackEntityFrom(source, amount);
}
示例4: isPhysicalDamage
import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
private static boolean isPhysicalDamage(DamageSource damageSource)
{
return damageSource.getImmediateSource() != null && !damageSource.isProjectile() && !damageSource.isExplosion() && !damageSource.isFireDamage() && !damageSource.isMagicDamage() && !damageSource.isDamageAbsolute();
}