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


Java EntityDamageSourceIndirect类代码示例

本文整理汇总了Java中net.minecraft.util.EntityDamageSourceIndirect的典型用法代码示例。如果您正苦于以下问题:Java EntityDamageSourceIndirect类的具体用法?Java EntityDamageSourceIndirect怎么用?Java EntityDamageSourceIndirect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
	if (isEntityInvulnerable(source)) {
		return false;
	}
	if ((source instanceof EntityDamageSourceIndirect)) {
		for (int i = 0; i < 64; i++) {
		}
		return false;
	}
	boolean flag = super.attackEntityFrom(source, amount);
	if ((source.isUnblockable()) && (rand.nextInt(10) != 0)) {
		teleportRandomly();
	}
	return flag;
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:17,代码来源:EntityFrienderman.java

示例2: snowballFight

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
public boolean snowballFight(DamageSource damagesource) {
	if (damagesource instanceof EntityDamageSourceIndirect) {
		EntityDamageSourceIndirect snowdamage = (EntityDamageSourceIndirect) damagesource;

		if (snowdamage.getSourceOfDamage() != null && snowdamage
				.getSourceOfDamage() instanceof EntitySnowball) {
			snowballin += 1;

			if (attackTime < 10) {
				attackTime = 10;
			}
		}
	}

	return snowballin <= 0;
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:17,代码来源:EntityFairy.java

示例3: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@Override
public boolean attackEntityFrom(DamageSource damageSource, float damage) {
    if (damageSource instanceof EntityDamageSourceIndirect) {
        return false;
    }
    Entity src = damageSource.getSourceOfDamage();
    if (!(src instanceof EntityPlayer)) {
        return false;
    }
    if (isDead) {
        return false;
    }
    EntityPlayer player = (EntityPlayer) src;
    if (worldObj.isRemote) return true;
    setDead();
    if (!PlayerUtil.isPlayerCreative(player)) dropItemsOnBreak();
    return true;
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:19,代码来源:AbstractServoMachine.java

示例4: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@Override
public boolean attackEntityFrom(DamageSource source, float damage)
{
	if(source instanceof EntityDamageSourceIndirect)
	{
		EntityDamageSourceIndirect src = (EntityDamageSourceIndirect)source;
		
		if(src.getEntity() != null && src.getEntity() == this)
		{
			return false;
		}
	}
	if(this.hurtTime == 0)
	{
		playSound("mob.skeleton.hurt", 1.0F, 1.0F);
	}
	if(!worldObj.isRemote)
	{
		System.out.println("Dam: " + damage);
	}
	return super.attackEntityFrom(source, damage);
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:23,代码来源:EntitySkeletalKnight.java

示例5: onImpact

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition pos) {
	if (pos.entityHit instanceof EntityEnderman) return;
	if (pos.typeOfHit == MovingObjectType.BLOCK) {
		if (worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ).getMaterial().isReplaceable()) return;
	}
	setDead();
	if (!worldObj.isRemote) {
		if (pos.entityHit != null && pos.entityHit instanceof EntityLivingBase) {
			float min = (float)FarragoMod.config.getDouble("blunderbuss.damage.min");
			float max = (float)FarragoMod.config.getDouble("blunderbuss.damage.max");
			((EntityLivingBase)pos.entityHit).attackEntityFrom(new EntityDamageSourceIndirect("blunderbuss", this, getThrower()), (rand.nextFloat()*(max-min))+min);
			((EntityLivingBase)pos.entityHit).hurtResistantTime = 1;
		}
		if (worldObj instanceof WorldServer) {
			((WorldServer)worldObj).func_147487_a("smoke", pos.hitVec.xCoord, pos.hitVec.yCoord, pos.hitVec.zCoord, 1, 0.2f, 0.2f, 0.2f, 0f);
			((WorldServer)worldObj).playSoundAtEntity(this, "step.stone", 0.5f, 0.3f);
		}
	}
}
 
开发者ID:unascribed,项目名称:Farrago,代码行数:21,代码来源:EntityBlunderbussProjectile.java

示例6: func_70097_a

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
   if(this.func_85032_ar()) {
      return false;
   } else {
      this.func_70819_e(true);
      if(p_70097_1_ instanceof EntityDamageSource && p_70097_1_.func_76346_g() instanceof EntityPlayer) {
         this.field_104003_g = true;
      }

      if(p_70097_1_ instanceof EntityDamageSourceIndirect) {
         this.field_104003_g = false;

         for(int var3 = 0; var3 < 64; ++var3) {
            if(this.func_70820_n()) {
               return true;
            }
         }

         return false;
      } else {
         return super.func_70097_a(p_70097_1_, p_70097_2_);
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:EntityEnderman.java

示例7: onLivingHurt

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event)
{
    if(event.source.getEntity() instanceof EntityPlayerMP && !(event.source instanceof EntityDamageSourceIndirect))
    {
        EntityPlayer player = (EntityPlayer)event.source.getEntity();
        MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

        if(info != null && player.getCurrentEquippedItem() == null)
        {
            for(Ability ab : info.morphAbilities)
            {
                if(ab instanceof AbilityPotionEffect)
                {
                    AbilityPotionEffect abPot = (AbilityPotionEffect)ab;
                    event.entityLiving.addPotionEffect(new PotionEffect(abPot.potionId, abPot.duration, abPot.amplifier, abPot.ambient));
                }
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Morph,代码行数:22,代码来源:EventHandler.java

示例8: onHit

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@Override
public void onHit(EntityThrown entity, RayTraceResult result, boolean isServer) {
	if(result.entityHit != null && result.entityHit != entity.getThrower())
	{
		entity.setDead();
		if(result.entityHit.attackEntityFrom(new EntityDamageSourceIndirect("ender_bow", entity, entity.getThrower() == null ? entity : entity.getThrower()).setProjectile(), power * 20f))
			entity.playSound(SoundEvents.ENTITY_ARROW_HIT, 1.0F, 1.2F / (itemRand.nextFloat() * 0.2F + 0.9F));
	}
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:10,代码来源:EnderBow.java

示例9: livingAttack

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
@SubscribeEvent
public void livingAttack(LivingAttackEvent event) {
	if (event.source instanceof EntityDamageSourceIndirect) {
		EntityDamageSourceIndirect dmgSrc = (EntityDamageSourceIndirect) event.source;
		if (dmgSrc.getSourceOfDamage() instanceof EntityTippedArrow) {
			EntityTippedArrow tippedArrow = (EntityTippedArrow) dmgSrc.getSourceOfDamage();
			if (!tippedArrow.worldObj.isRemote)
				event.entityLiving.addPotionEffect(tippedArrow.getEffect());
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:12,代码来源:ServerEventHandler.java

示例10: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (!this.world.isRemote && !this.isDead)
    {
        if (source instanceof EntityDamageSourceIndirect && source.getEntity() != null && this.isPassenger(source.getEntity()))
        {
            return false;
        }
        else
        {
            this.setForwardDirection(-this.getForwardDirection());
            this.setTimeSinceHit(10);
            this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
            this.setBeenAttacked();
            boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;

            if (flag || this.getDamageTaken() > 40.0F)
            {
                if (!flag && this.world.getGameRules().getBoolean("doEntityDrops"))
                {
                    this.dropItemWithOffset(this.getItemBoat(), 1, 0.0F);
                }

                this.setDead();
            }

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

示例11: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (source instanceof EntityDamageSourceIndirect)
    {
        for (int i = 0; i < 64; ++i)
        {
            if (this.teleportRandomly())
            {
                return true;
            }
        }

        return false;
    }
    else
    {
        boolean flag = super.attackEntityFrom(source, amount);

        if (source.isUnblockable() && this.rand.nextInt(10) != 0)
        {
            this.teleportRandomly();
        }

        return flag;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:EntityEnderman.java

示例12: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource source, float amount)
{
    if (this.isEntityInvulnerable(source))
    {
        return false;
    }
    else if (!this.worldObj.isRemote && !this.isDead)
    {
        if (source instanceof EntityDamageSourceIndirect && source.getEntity() != null && this.isPassenger(source.getEntity()))
        {
            return false;
        }
        else
        {
            this.setForwardDirection(-this.getForwardDirection());
            this.setTimeSinceHit(10);
            this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
            this.setBeenAttacked();
            boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode;

            if (flag || this.getDamageTaken() > 40.0F)
            {
                if (!flag && this.worldObj.getGameRules().getBoolean("doEntityDrops"))
                {
                    this.dropItemWithOffset(this.getItemBoat(), 1, 0.0F);
                }

                this.setDead();
            }

            return true;
        }
    }
    else
    {
        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:42,代码来源:EntityBoat.java

示例13: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
public boolean attackEntityFrom(DamageSource source, float amount) {
	if (this.isEntityInvulnerable(source)) {
		return false;
	}

	if (!world.isRemote) {
		if (source instanceof EntityDamageSourceIndirect) {
			redirectArrowAtAttacker(source);
		} else {
			redirectAttack(source, amount);
		}
	}

	return false;
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:16,代码来源:EntityMonolithEye.java

示例14: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
public boolean attackEntityFrom(DamageSource source, float amount) {
	if (this.isEntityInvulnerable(source)) {
		return false;
	}

	if (source instanceof EntityDamageSourceIndirect) {
		redirectArrowAtAttacker(source);
		return false;
	} else {
		amount = redirectAttack(source, amount);
	}

	return super.attackEntityFrom(source, amount);
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:15,代码来源:EntityMage.java

示例15: attackEntityFrom

import net.minecraft.util.EntityDamageSourceIndirect; //导入依赖的package包/类
public boolean attackEntityFrom(DamageSource source, float amount) {
	if (this.isEntityInvulnerable(source)) {
		return false;
	}

	if (source instanceof EntityDamageSourceIndirect) {
		attackDistantAttackerWithBats(source);
	}

	return super.attackEntityFrom(source, amount);
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:12,代码来源:EntityBas.java


注:本文中的net.minecraft.util.EntityDamageSourceIndirect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。