/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (this.isEntityInvulnerable()) { return false; } else { this.setBeenAttacked(); if (par1DamageSource.getEntity() != null) { Vec3 var3 = par1DamageSource.getEntity().getLookVec(); if (var3 != null) { this.motionX = var3.xCoord; this.motionY = var3.yCoord; this.motionZ = var3.zCoord; this.accelerationX = this.motionX * 0.1D; this.accelerationY = this.motionY * 0.1D; this.accelerationZ = this.motionZ * 0.1D; } if (par1DamageSource.getEntity() instanceof EntityLiving) { this.shootingEntity = (EntityLiving) par1DamageSource.getEntity(); } return true; } else { return false; } } }
public boolean func_70097_a(DamageSource p_70097_1_, int p_70097_2_) { if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { if (this.func_85032_ar()) { return false; } else { this.func_70494_i(-this.func_70493_k()); this.func_70497_h(10); this.func_70018_K(); this.func_70492_c(this.func_70491_i() + p_70097_2_ * 10); boolean var3 = p_70097_1_.func_76346_g() instanceof EntityPlayer && ((EntityPlayer) p_70097_1_.func_76346_g()).field_71075_bZ.field_75098_d; if (var3 || this.func_70491_i() > 40) { if (this.field_70153_n != null) { this.field_70153_n.func_70078_a(this); } if (var3 && !this.func_94042_c()) { this.func_70106_y(); } else { this.func_94095_a(p_70097_1_); } } return true; } } else { return true; } }
/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (this.func_85032_ar()) { return false; } else if (!this.worldObj.isRemote && !this.isDead) { this.setForwardDirection(-this.getForwardDirection()); this.setTimeSinceHit(10); this.setDamageTaken(this.getDamageTaken() + par2 * 10); this.setBeenAttacked(); if (par1DamageSource.getEntity() instanceof EntityPlayer && ((EntityPlayer) par1DamageSource.getEntity()).capabilities.isCreativeMode) { this.setDamageTaken(100); } if (this.getDamageTaken() > 40) { if (this.riddenByEntity != null) { this.riddenByEntity.mountEntity(this); } this.dropItemWithOffset(Item.boat.shiftedIndex, 1, 0.0F); this.setDead(); } return true; } else { return true; } }
protected void damageEntity(DamageSource damagesource, int i) { if (!damagesource.isUnblockable() && isBlocking()) { i = 1 + i >> 1; } i = applyArmorCalculations(damagesource, i); i = applyPotionDamageCalculations(damagesource, i); addExhaustion(damagesource.getHungerDamage()); health -= i; }
public void func_94095_a(DamageSource p_94095_1_) { super.func_94095_a(p_94095_1_); double var2 = this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y; if (!p_94095_1_.func_94541_c()) { this.func_70099_a(new ItemStack(Block.field_72091_am, 1), 0.0F); } if (p_94095_1_.func_76347_k() || p_94095_1_.func_94541_c() || var2 >= 0.009999999776482582D) { this.func_94103_c(var2); } }
public void onDeath(DamageSource var1) { super.onDeath(var1); if (var1.getSourceOfDamage() instanceof EntityArrow && var1.getEntity() instanceof EntityPlayer) { EntityPlayer var2 = (EntityPlayer) var1.getEntity(); double var3 = var2.posX - this.posX; double var5 = var2.posZ - this.posZ; if (var3 * var3 + var5 * var5 >= 2500.0D) { var2.triggerAchievement(AchievementList.snipeSkeleton); } } }
/** * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first * and then health second with the reduced value. Args: damageAmount */ protected void damageEntity(DamageSource par1DamageSource, int par2) { if (!par1DamageSource.isUnblockable() && this.isBlocking()) { par2 = 1 + par2 >> 1; } par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2); if (par2 <= 0) { return; } par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); this.addExhaustion(par1DamageSource.getHungerDamage()); this.health -= par2; }
public void damage(int amount, CraftEntity source) { net.minecraft.src.DamageSource reason = net.minecraft.src.DamageSource.generic; if (source instanceof CraftHumanEntity) { reason = net.minecraft.src.DamageSource.causePlayerDamage( ((CraftHumanEntity) source).getMCPlayer()); } else if (source instanceof CraftLivingEntity) { reason = net.minecraft.src.DamageSource.causeMobDamage( ((CraftLivingEntity) source).getEntityLiving()); } getEntityLiving().damageEntity(reason, amount); }
/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { if (this.capabilities.disableDamage && !par1DamageSource.canHarmInCreative()) { return false; } else { this.entityAge = 0; if (this.getHealth() <= 0) { return false; } else { if (this.isPlayerSleeping() && !this.worldObj.isRemote) { this.wakeUpPlayer(true, true, false); } Entity var3 = par1DamageSource.getEntity(); if (var3 instanceof EntityMob || var3 instanceof EntityArrow) { if (this.worldObj.difficultySetting == 0) { par2 = 0; } if (this.worldObj.difficultySetting == 1) { par2 = par2 / 2 + 1; } if (this.worldObj.difficultySetting == 3) { par2 = par2 * 3 / 2; } } if (par2 == 0) { return false; } else { Entity var4 = var3; if (var3 instanceof EntityArrow && ((EntityArrow) var3).shootingEntity != null) { var4 = ((EntityArrow) var3).shootingEntity; } if (var4 instanceof EntityLiving) { this.alertWolves((EntityLiving) var4, false); } this.addStat(StatList.damageTakenStat, par2); return super.attackEntityFrom(par1DamageSource, par2); } } } }
/** Called when the mob's health reaches 0. */ public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); if (par1DamageSource.getEntity() instanceof EntitySkeleton) { this.dropItem(Item.record13.shiftedIndex + this.rand.nextInt(10), 1); } }
/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { if (this.isEntityInvulnerable()) { return false; } else { boolean var3 = this.mcServer.isDedicatedServer() && this.mcServer.isPVPEnabled() && "fall".equals(par1DamageSource.damageType); if (!var3 && this.initialInvulnerability > 0 && par1DamageSource != DamageSource.outOfWorld) { return false; } else { if (par1DamageSource instanceof EntityDamageSource) { Entity var4 = par1DamageSource.getEntity(); if (var4 instanceof EntityPlayer && !this.func_96122_a((EntityPlayer) var4)) { return false; } if (var4 instanceof EntityArrow) { EntityArrow var5 = (EntityArrow) var4; if (var5.shootingEntity instanceof EntityPlayer && !this.func_96122_a((EntityPlayer) var5.shootingEntity)) { return false; } } } return super.attackEntityFrom(par1DamageSource, par2); } } }
public boolean attackEntityfrom(DamageSource par1DamageSource, int par2) { Entity entity = par1DamageSource.getEntity(); fearSource = par1DamageSource.getEntity(); // System.out.println("yep"); if (entity.getClass() == getClass() && (((EntityAnimalTFC) entity).rutting)) { setAttackTarget((EntityLiving) entity); if (getHealth() <= getMaxHealth() / 4) { ((EntityAnimalTFC) getAttackTarget()).ruttVictor = true; } } if (isChild() && parent.children.contains(this) && par1DamageSource.getEntity() instanceof EntityLiving) { parent.setAttackTarget((EntityLiving) par1DamageSource.getEntity()); } return super.attackEntityFrom(par1DamageSource, par2); }
public boolean func_70097_a(DamageSource p_70097_1_, int p_70097_2_) { Entity entity = p_70097_1_.func_76346_g(); field_70911_d.func_75270_a(false); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { p_70097_2_ = (p_70097_2_ + 1) / 2; } return super.func_70097_a(p_70097_1_, p_70097_2_); }
/** Attacks all entities inside this list, dealing 5 hearts of damage. */ private void attackEntitiesInList(List par1List) { for (int var2 = 0; var2 < par1List.size(); ++var2) { Entity var3 = (Entity) par1List.get(var2); if (var3 instanceof EntityLivingBase) { var3.attackEntityFrom(DamageSource.causeMobDamage(this), 10.0F); } } }
protected void func_70227_a(MovingObjectPosition p_70227_1_) { if (!field_70170_p.field_72995_K) { if (p_70227_1_.field_72308_g != null) { p_70227_1_.field_72308_g.func_70097_a(DamageSource.func_76362_a(this, field_70235_a), 6); } field_70170_p.func_72885_a(null, field_70165_t, field_70163_u, field_70161_v, 1.0F, true); func_70106_y(); } }
@Override public void applyRepeatedEffect(PixelmonEntityHelper user, PixelmonEntityHelper target) { ChatHandler.sendChat( user.getOwner(), target.getOwner(), user.getName() + " is hurt by poison!"); user.attackEntityFrom( DamageSource.causeMobDamage((EntityLiving) user.getEntity()), (int) (((float) user.getMaxHealth()) * poisonAmount)); poisonAmount += 1 / 16; }
/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { Entity entity = par1DamageSource.getEntity(); aiSit.func_48407_a(false); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { par2 = (par2 + 1) / 2; } return super.attackEntityFrom(par1DamageSource, par2); }
@Override public void applyRepeatedEffect(PixelmonEntityHelper user, PixelmonEntityHelper target) { ChatHandler.sendChat( user.getOwner(), target.getOwner(), user.getName() + " is trapped in a vortex and takes damage!"); user.attackEntityFrom( DamageSource.causeMobDamage((EntityLiving) user.getEntity()), (int) (((float) user.getMaxHealth()) / 16)); }
public boolean attackEntityFrom(DamageSource damagesource, int i) { Entity entity = damagesource.getEntity(); if (entity != null && entity != this && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).username == getBotOwner()) { i = 20; } return super.attackEntityFrom(damagesource, i); }
protected void func_40063_a(MovingObjectPosition par1MovingObjectPosition) { if (!worldObj.isRemote) { if (par1MovingObjectPosition.entityHit != null) { if (!par1MovingObjectPosition.entityHit.attackEntityFrom( DamageSource.causeFireballDamage(this, shootingEntity), 4)) ; } worldObj.newExplosion(null, posX, posY, posZ, 1.0F, true); setDead(); } }
public boolean func_70097_a(DamageSource p_70097_1_, int p_70097_2_) { func_70018_K(); if (p_70097_1_.func_76346_g() != null) { Vec3 vec3 = p_70097_1_.func_76346_g().func_70040_Z(); if (vec3 != null) { field_70159_w = vec3.field_72450_a; field_70181_x = vec3.field_72448_b; field_70179_y = vec3.field_72449_c; field_70232_b = field_70159_w * 0.10000000000000001D; field_70233_c = field_70181_x * 0.10000000000000001D; field_70230_d = field_70179_y * 0.10000000000000001D; } if (p_70097_1_.func_76346_g() instanceof EntityLiving) { field_70235_a = (EntityLiving) p_70097_1_.func_76346_g(); } return true; } else { return false; } }
protected void func_40071_a(MovingObjectPosition par1MovingObjectPosition) { if (!this.worldObj.isRemote) { if (par1MovingObjectPosition.entityHit != null && par1MovingObjectPosition.entityHit.attackEntityFrom( DamageSource.causeFireballDamage(this, this.shootingEntity), 4)) {; } this.worldObj.newExplosion((Entity) null, this.posX, this.posY, this.posZ, 1.0F, true); this.setDead(); } }
public boolean attackEntityFromPart( EntityDragonPart par1EntityDragonPart, DamageSource par2DamageSource, float par3) { if (par1EntityDragonPart != this.dragonPartHead) { par3 = par3 / 4.0F + 1.0F; } float var4 = this.rotationYaw * (float) Math.PI / 180.0F; float var5 = MathHelper.sin(var4); float var6 = MathHelper.cos(var4); this.targetX = this.posX + (double) (var5 * 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) (var6 * 5.0F) + (double) ((this.rand.nextFloat() - 0.5F) * 2.0F); this.target = null; if (par2DamageSource.getEntity() instanceof EntityPlayer || par2DamageSource.isExplosion()) { this.func_82195_e(par2DamageSource, par3); } return true; }
/** Called by a player entity when they collide with an entity */ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (canDamagePlayer()) { int i = getSlimeSize(); if (canEntityBeSeen(par1EntityPlayer) && getDistanceSqToEntity(par1EntityPlayer) < 0.59999999999999998D * (double) i * (0.59999999999999998D * (double) i) && par1EntityPlayer.attackEntityFrom( DamageSource.causeMobDamage(this), getAttackStrength())) { worldObj.playSoundAtEntity( this, "mob.slimeattack", 1.0F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); } } }
/** Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { setBeenAttacked(); if (par1DamageSource.getEntity() != null) { Vec3D vec3d = par1DamageSource.getEntity().getLookVec(); if (vec3d != null) { motionX = vec3d.xCoord; motionY = vec3d.yCoord; motionZ = vec3d.zCoord; accelerationX = motionX * 0.10000000000000001D; accelerationY = motionY * 0.10000000000000001D; accelerationZ = motionZ * 0.10000000000000001D; } if (par1DamageSource.getEntity() instanceof EntityLiving) { shootingEntity = (EntityLiving) par1DamageSource.getEntity(); } return true; } else { return false; } }
public boolean attackEntityFrom(DamageSource damagesource, int i) { if (capabilities.disableDamage && !damagesource.canHarmInCreative()) { return false; } entityAge = 0; if (getEntityHealth() <= 0) { return false; } if (isPlayerSleeping() && !worldObj.multiplayerWorld) { wakeUpPlayer(true, true, false); } Entity entity = damagesource.getEntity(); if ((entity instanceof EntityMob) || (entity instanceof EntityArrow)) { if (worldObj.difficultySetting == 0) { i = 0; } if (worldObj.difficultySetting == 1) { i = i / 2 + 1; } if (worldObj.difficultySetting == 3) { i = (i * 3) / 2; } } if (i == 0) { return false; } Entity entity1 = entity; if ((entity1 instanceof EntityArrow) && ((EntityArrow) entity1).shootingEntity != null) { entity1 = ((EntityArrow) entity1).shootingEntity; } if (entity1 instanceof EntityLiving) { alertWolves((EntityLiving) entity1, false); } addStat(StatList.damageTakenStat, i); return super.attackEntityFrom(damagesource, i); }
public boolean func_396_a(DamageSource damagesource, int i) { Entity entity = damagesource.func_35532_a(); if (entity instanceof EntityPlayer) { List list = field_615_ag.func_659_b(this, field_601_au.func_1177_b(32D, 32D, 32D)); for (int j = 0; j < list.size(); j++) { Entity entity1 = (Entity) list.get(j); if (entity1 instanceof EntityPigZombie) { EntityPigZombie entitypigzombie = (EntityPigZombie) entity1; entitypigzombie.func_4049_h(entity); } } func_4049_h(entity); } return super.func_396_a(damagesource, i); }
public static EntityDamageEvent handleEntityDamageEvent( Entity entity, DamageSource source, int damage) { Entity damager = source.getEntity(); DamageCause cause = DamageCause.ENTITY_ATTACK; if (source instanceof EntityDamageSourceIndirect) { damager = ((EntityDamageSourceIndirect) source).getSourceOfDamage(); if (getBukkitEntity(damager) instanceof ThrownPotion) { cause = DamageCause.MAGIC; } else if (getBukkitEntity(damager) instanceof Projectile) { cause = DamageCause.PROJECTILE; } } return callEntityDamageEvent(damager, entity, cause, damage); }
public boolean func_70097_a(DamageSource p_70097_1_, int p_70097_2_) { if (p_70097_1_ instanceof EntityDamageSourceIndirect) { for (int var3 = 0; var3 < 64; ++var3) { if (this.func_70820_n()) { return true; } } return false; } else { if (p_70097_1_.func_76346_g() instanceof EntityPlayer) { this.func_70819_e(true); } return super.func_70097_a(p_70097_1_, p_70097_2_); } }
public boolean attackEntityFrom(DamageSource damagesource, int i) { if (ticksOfInvuln > 0) { return false; } if (!mcServer.pvpOn && (damagesource instanceof EntityDamageSource)) { Entity entity = damagesource.getEntity(); if (entity instanceof EntityPlayer) { return false; } if (entity instanceof EntityArrow) { EntityArrow entityarrow = (EntityArrow) entity; if (entityarrow.shootingEntity instanceof EntityPlayer) { return false; } } } return super.attackEntityFrom(damagesource, i); }