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


Java DamageSource.isFireDamage方法代碼示例

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


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

示例1: onHurtEvent

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
@SubscribeEvent
public static void onHurtEvent(LivingHurtEvent event)
{
    EntityLivingBase entity = event.getEntityLiving();
    DamageSource damageSource = event.getSource();
    float damage = event.getAmount();
    if(entity != null)
    {
        IAttributeInstance damageRate = null;
        if(isPhysicalDamage(damageSource))
            damageRate = entity.getEntityAttribute(PHYSICAL_DAMAGE_RATE);
        if(damageSource.isFireDamage())
            damageRate = entity.getEntityAttribute(FIRE_DAMAGE_RATE);

        if(damageRate != null)
            damage *= damageRate.getAttributeValue();
    }
    event.setAmount(damage);
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:20,代碼來源:Attributes.java

示例2: attackEntityFrom

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public boolean attackEntityFrom(DamageSource source, float damage){
	if (this.isEntityInvulnerable(source))
       {
           return false;
       }
	else if(source.getTrueSource() != null && source.getTrueSource() instanceof EntityLivingBase &&
			!TF2Util.isOnSameTeam(source.getTrueSource(), this.shootingEntity)&& !(source.isExplosion() || source.isFireDamage())){
		if (source instanceof TF2DamageSource) {
			damage *= Math.max(1f,TF2Attribute.getModifier("Destroy Projectiles", ((TF2DamageSource)source).getWeapon(), 0, (EntityLivingBase) source.getTrueSource()));
		}
		this.health -= damage;
		if (this.health <= 0)
			this.setDead();
		return true;
	}
	return false;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:18,代碼來源:EntityProjectileBase.java

示例3: killMinecart

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void killMinecart(DamageSource p_94095_1_)
{
    super.killMinecart(p_94095_1_);
    double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ;

    if (!p_94095_1_.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops"))
    {
        this.entityDropItem(new ItemStack(Blocks.tnt, 1), 0.0F);
    }

    if (p_94095_1_.isFireDamage() || p_94095_1_.isExplosion() || d0 >= 0.009999999776482582D)
    {
        this.explodeCart(d0);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:EntityMinecartTNT.java

示例4: calcModifierDamage

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
/**
 * Calculates the damage protection of the enchantment based on level and damage source passed.
 */
public int calcModifierDamage(int level, DamageSource source)
{
    if (source.canHarmInCreative())
    {
        return 0;
    }
    else
    {
        float f = (float)(6 + level * level) / 3.0F;
        return this.protectionType == 0 ? MathHelper.floor_float(f * 0.75F) : (this.protectionType == 1 && source.isFireDamage() ? MathHelper.floor_float(f * 1.25F) : (this.protectionType == 2 && source == DamageSource.fall ? MathHelper.floor_float(f * 2.5F) : (this.protectionType == 3 && source.isExplosion() ? MathHelper.floor_float(f * 1.5F) : (this.protectionType == 4 && source.isProjectile() ? MathHelper.floor_float(f * 1.5F) : 0))));
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:EnchantmentProtection.java

示例5: killMinecart

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void killMinecart(DamageSource source)
{
    super.killMinecart(source);
    double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ;

    if (!source.isExplosion() && this.world.getGameRules().getBoolean("doEntityDrops"))
    {
        this.entityDropItem(new ItemStack(Blocks.TNT, 1), 0.0F);
    }

    if (source.isFireDamage() || source.isExplosion() || d0 >= 0.009999999776482582D)
    {
        this.explodeCart(d0);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:EntityMinecartTNT.java

示例6: killMinecart

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
public void killMinecart(DamageSource source)
{
    super.killMinecart(source);
    double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ;

    if (!source.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops"))
    {
        this.entityDropItem(new ItemStack(Blocks.TNT, 1), 0.0F);
    }

    if (source.isFireDamage() || source.isExplosion() || d0 >= 0.009999999776482582D)
    {
        this.explodeCart(d0);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:EntityMinecartTNT.java

示例7: 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();
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:5,代碼來源:Attributes.java

示例8: damageEntity

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
@Override
protected void damageEntity(DamageSource dmgSource, float dmg)
   {
	if (this.isEntityInvulnerable()) { return; }	// Nothing to be done here
       
       dmg = ForgeHooks.onLivingHurt(this, dmgSource, dmg);
       if (dmg <= 0) return;
       
       dmg = this.applyArmorCalculations(dmgSource, dmg);
       dmg = this.applyPotionDamageCalculations(dmgSource, dmg);
       
       if (this.hasHeavyPlatingUpgrade)
       {
       	if (!dmgSource.isUnblockable()) { dmg -= this.armorPlatingDmgReduction; }		// If it can be blocked we can defend against it
       	else if (dmgSource.isFireDamage()) { dmg -= this.armorPlatingDmgReduction; }	// Fire is usually unblockable, hm?
       }
       
       if (dmgSource.getDamageType().equals("inWall")) { dmg = 0; }		// Not suffocating in a wall
   	else if (dmgSource.getDamageType().equals("starve")) { dmg = 0; }	// Don't need to eat
       
       if (dmg <= 0) return;
       
       // Damage absorption, if we have it
       float tempDmg = dmg;
       dmg = Math.max(dmg - this.getAbsorptionAmount(), 0.0F);
       this.setAbsorptionAmount(this.getAbsorptionAmount() - (tempDmg - dmg));

       if (dmg != 0.0F)
       {
           float health = this.getHealth();
           this.setHealth(health - dmg);
           this.func_110142_aN().func_94547_a(dmgSource, health, dmg);
           this.setAbsorptionAmount(this.getAbsorptionAmount() - dmg);
       }
       // else, damage is 0. Nothing to be done here
       
       if (!this.worldObj.isRemote && this.getHealth() < this.getMaxHealth() / 3)
       {
       	// Has less than a third health left
       	if (this.hasCommunicationUpgrade && AI_Targeting.isNameOnWhitelist(this, Commands.cmdTellHealth))
       	{
       		AI_Communication.tellOwnerAboutHealth(this);
       	}
       }
   }
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:46,代碼來源:Entity_AA.java

示例9: calcModifierDamage

import net.minecraft.util.DamageSource; //導入方法依賴的package包/類
/**
 * Calculates the damage protection of the enchantment based on level and damage source passed.
 */
public int calcModifierDamage(int level, DamageSource source)
{
    return source.canHarmInCreative() ? 0 : (this.protectionType == EnchantmentProtection.Type.ALL ? level : (this.protectionType == EnchantmentProtection.Type.FIRE && source.isFireDamage() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.FALL && source == DamageSource.fall ? level * 3 : (this.protectionType == EnchantmentProtection.Type.EXPLOSION && source.isExplosion() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.PROJECTILE && source.isProjectile() ? level * 2 : 0)))));
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:EnchantmentProtection.java


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