當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。