本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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))));
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
}
}
示例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)))));
}