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