本文整理匯總了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();
}