当前位置: 首页>>代码示例>>Java>>正文


Java DamageSource.isExplosion方法代码示例

本文整理汇总了Java中net.minecraft.util.DamageSource.isExplosion方法的典型用法代码示例。如果您正苦于以下问题:Java DamageSource.isExplosion方法的具体用法?Java DamageSource.isExplosion怎么用?Java DamageSource.isExplosion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.DamageSource的用法示例。


在下文中一共展示了DamageSource.isExplosion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:EntityGuardian.java

示例2: onAttack

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
@Override
public void onAttack(LivingAttackEvent event, DamageSource source, EntityLivingBase affected, int amplifier) {
	if (amplifier >= 3) {
		if (!source.isExplosion()) {
			BrewStorageHandler.removeActiveBrew(affected, this);
			affected.world.createExplosion(source.getImmediateSource(), affected.posX, affected.posY + 1.2D, affected.posZ, amplifier + 3, true);

		}
	}

	if (amplifier == 2) {
		if (!source.isExplosion()) {
			BrewStorageHandler.removeActiveBrew(affected, this);
			affected.world.createExplosion(source.getImmediateSource(), affected.posX, affected.posY + 0.7D, affected.posZ, amplifier + 2, true);

		}
	}
	if (!source.isExplosion()) {
		BrewStorageHandler.removeActiveBrew(affected, this);
		affected.world.createExplosion(source.getImmediateSource(), affected.posX, affected.posY + 0.5D, affected.posZ, amplifier + 1, true);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:23,代码来源:VolatileBrew.java

示例3: attackEntityFrom

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (this.getEntityItem() != null && this.getEntityItem().getItem() == Items.nether_star && source.isExplosion())
    {
        return false;
    }
    else
    {
        this.setBeenAttacked();
        this.health = (int)((float)this.health - amount);

        if (this.health <= 0)
        {
            this.setDead();
        }

        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:EntityItem.java

示例4: attackEntityFromPart

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float p_70965_3_)
{
    if (dragonPart != this.dragonPartHead)
    {
        p_70965_3_ = p_70965_3_ / 4.0F + 1.0F;
    }

    float f = this.rotationYaw * (float)Math.PI / 180.0F;
    float f1 = MathHelper.sin(f);
    float f2 = MathHelper.cos(f);
    this.targetX = this.posX + (double)(f1 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
    this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D;
    this.targetZ = this.posZ - (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F);
    this.target = null;

    if (source.getEntity() instanceof EntityPlayer || source.isExplosion())
    {
        this.attackDragonFrom(source, p_70965_3_);
    }

    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:EntityDragon.java

示例5: attackEntityFrom

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (!source.isExplosion() && this.getDisplayedItem() != null)
    {
        if (!this.worldObj.isRemote)
        {
            this.dropItemOrSelf(source.getEntity(), false);
            this.setDisplayedItem((ItemStack)null);
        }

        return true;
    }
    else
    {
        return super.attackEntityFrom(source, amount);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:EntityItemFrame.java

示例6: 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

示例7: 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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:EntityGuardian.java

示例8: attackEntityFrom

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (!source.isExplosion() && this.getDisplayedItem() != null)
    {
        if (!this.worldObj.isRemote)
        {
            this.dropItemOrSelf(source.getEntity(), false);
            this.playSound(SoundEvents.ENTITY_ITEMFRAME_REMOVE_ITEM, 1.0F, 1.0F);
            this.setDisplayedItem((ItemStack)null);
        }

        return true;
    }
    else
    {
        return super.attackEntityFrom(source, amount);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:EntityItemFrame.java

示例9: killMinecart

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
public void killMinecart(DamageSource p_94095_1_)
{
    super.killMinecart(p_94095_1_);

    if (!p_94095_1_.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops"))
    {
        this.entityDropItem(new ItemStack(Blocks.furnace, 1), 0.0F);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:EntityMinecartFurnace.java

示例10: isPoweredCreeper

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
private boolean isPoweredCreeper(DamageSource source) {
	if (source.isExplosion() && source instanceof EntityDamageSource) {
		Entity entity = ((EntityDamageSource) source).getEntity();
		if (entity != null && entity instanceof EntityCreeper)
			return ((EntityCreeper) entity).getPowered();
	}

	return false;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:10,代码来源:ServerEventHandler.java

示例11: 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

示例12: 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

示例13: killMinecart

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
public void killMinecart(DamageSource source)
{
    super.killMinecart(source);

    if (!source.isExplosion() && this.world.getGameRules().getBoolean("doEntityDrops"))
    {
        this.entityDropItem(new ItemStack(Blocks.FURNACE, 1), 0.0F);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:EntityMinecartFurnace.java

示例14: attackEntityFromPart

import net.minecraft.util.DamageSource; //导入方法依赖的package包/类
public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float damage)
{
    damage = this.phaseManager.getCurrentPhase().getAdjustedDamage(dragonPart, source, damage);

    if (dragonPart != this.dragonPartHead)
    {
        damage = damage / 4.0F + Math.min(damage, 1.0F);
    }

    if (damage < 0.01F)
    {
        return false;
    }
    else
    {
        if (source.getEntity() instanceof EntityPlayer || source.isExplosion())
        {
            float f = this.getHealth();
            this.attackDragonFrom(source, damage);

            if (this.getHealth() <= 0.0F && !this.phaseManager.getCurrentPhase().getIsStationary())
            {
                this.setHealth(1.0F);
                this.phaseManager.setPhase(PhaseList.DYING);
            }

            if (this.phaseManager.getCurrentPhase().getIsStationary())
            {
                this.sittingDamageReceived = (int)((float)this.sittingDamageReceived + (f - this.getHealth()));

                if ((float)this.sittingDamageReceived > 0.25F * this.getMaxHealth())
                {
                    this.sittingDamageReceived = 0;
                    this.phaseManager.setPhase(PhaseList.TAKEOFF);
                }
            }
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:42,代码来源:EntityDragon.java

示例15: 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.isExplosion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。