/// <summary> /// Attacks all entities inside this list, dealing 5 hearts of damage. /// </summary> private void AttackEntitiesInList(List <Entity> par1List) { for (int i = 0; i < par1List.Count; i++) { Entity entity = par1List[i]; if (entity is EntityLiving) { entity.AttackEntityFrom(DamageSource.CauseMobDamage(this), 10); } } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { SetBeenAttacked(); Health -= par2; if (Health <= 0) { SetDead(); } return(false); }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { if ("fireball".Equals(par1DamageSource.GetDamageType()) && (par1DamageSource.GetEntity() is EntityPlayer)) { base.AttackEntityFrom(par1DamageSource, 1000); ((EntityPlayer)par1DamageSource.GetEntity()).TriggerAchievement(AchievementList.Ghast); return(true); } else { return(base.AttackEntityFrom(par1DamageSource, par2)); } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { Entity entity = par1DamageSource.GetEntity(); AiSit.Func_48407_a(false); if (entity != null && !(entity is EntityPlayer) && !(entity is EntityArrow)) { par2 = (par2 + 1) / 2; } return(base.AttackEntityFrom(par1DamageSource, par2)); }
public override bool AttackEntityAsMob(Entity par1Entity) { Field_48120_c = 10; WorldObj.SetEntityState(this, (sbyte)4); bool flag = par1Entity.AttackEntityFrom(DamageSource.CauseMobDamage(this), 7 + Rand.Next(15)); if (flag) { par1Entity.MotionY += 0.40000000596046448F; } WorldObj.PlaySoundAtEntity(this, "mob.irongolem.throw", 1.0F, 1.0F); return(flag); }
protected virtual void Func_40071_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(); } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { if (par1DamageSource is EntityDamageSourceIndirect) { for (int i = 0; i < 64; i++) { if (TeleportRandomly()) { return(true); } } return(false); } else { return(base.AttackEntityFrom(par1DamageSource, par2)); } }
/// <summary> /// Hits the provided entity with this potion's instant effect. /// </summary> public virtual void AffectEntity(EntityLiving par1EntityLiving, EntityLiving par2EntityLiving, int par3, double par4) { if (Id == Heal.Id && !par2EntityLiving.IsEntityUndead() || Id == Harm.Id && par2EntityLiving.IsEntityUndead()) { int i = (int)(par4 * (double)(6 << par3) + 0.5D); par2EntityLiving.Heal(i); } else if (Id == Harm.Id && !par2EntityLiving.IsEntityUndead() || Id == Heal.Id && par2EntityLiving.IsEntityUndead()) { int j = (int)(par4 * (double)(6 << par3) + 0.5D); if (par1EntityLiving == null) { par2EntityLiving.AttackEntityFrom(DamageSource.Magic, j); } else { par2EntityLiving.AttackEntityFrom(DamageSource.CauseIndirectMagicDamage(par2EntityLiving, par1EntityLiving), j); } } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { if (!IsDead && !WorldObj.IsRemote) { Health = 0; if (Health <= 0) { if (!WorldObj.IsRemote) { SetDead(); WorldObj.CreateExplosion(null, PosX, PosY, PosZ, 6F); } else { SetDead(); } } } return(true); }
/// <summary> /// Calculates de damage protection of the enchantment based on level and damage source passed. /// </summary> public override int CalcModifierDamage(int par1, DamageSource par2DamageSource) { if (par2DamageSource.CanHarmInCreative()) { return(0); } int i = (6 + par1 * par1) / 2; if (ProtectionType == 0) { return(i); } if (ProtectionType == 1 && par2DamageSource.FireDamage()) { return(i); } if (ProtectionType == 2 && par2DamageSource == DamageSource.Fall) { return(i * 2); } if (ProtectionType == 3 && par2DamageSource == DamageSource.Explosion) { return(i); } if (ProtectionType == 4 && par2DamageSource.IsProjectile()) { return(i); } else { return(0); } }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { Entity entity = par1DamageSource.GetEntity(); if (entity is EntityPlayer) { List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.Expand(32, 32, 32)); for (int i = 0; i < list.Count; i++) { Entity entity1 = list[i]; if (entity1 is EntityPigZombie) { EntityPigZombie entitypigzombie = (EntityPigZombie)entity1; entitypigzombie.BecomeAngryAt(entity); } } BecomeAngryAt(entity); } return(base.AttackEntityFrom(par1DamageSource, par2)); }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { if (WorldObj.IsRemote || IsDead) { return(true); } Func_41029_h(-Func_41030_m()); Func_41028_c(10); SetBeenAttacked(); Func_41024_b(Func_41025_i() + par2 * 10); if (Func_41025_i() > 40) { if (RiddenByEntity != null) { RiddenByEntity.MountEntity(this); } SetDead(); DropItemWithOffset(Item.MinecartEmpty.ShiftedIndex, 1, 0.0F); if (MinecartType == 1) { EntityMinecart entityminecart = this; label0: for (int i = 0; i < entityminecart.GetSizeInventory(); i++) { ItemStack itemstack = entityminecart.GetStackInSlot(i); if (itemstack == null) { continue; } float f = Rand.NextFloat() * 0.8F + 0.1F; float f1 = Rand.NextFloat() * 0.8F + 0.1F; float f2 = Rand.NextFloat() * 0.8F + 0.1F; do { if (itemstack.StackSize <= 0) { goto label0; } int j = Rand.Next(21) + 10; if (j > itemstack.StackSize) { j = itemstack.StackSize; } itemstack.StackSize -= j; EntityItem entityitem = new EntityItem(WorldObj, PosX + f, PosY + f1, PosZ + f2, new ItemStack(itemstack.ItemID, j, itemstack.GetItemDamage())); float f3 = 0.05F; entityitem.MotionX = (float)Rand.NextGaussian() * f3; entityitem.MotionY = (float)Rand.NextGaussian() * f3 + 0.2F; entityitem.MotionZ = (float)Rand.NextGaussian() * f3; WorldObj.SpawnEntityInWorld(entityitem); }while (true); } DropItemWithOffset(Block.Chest.BlockID, 1, 0.0F); } else if (MinecartType == 2) { DropItemWithOffset(Block.StoneOvenIdle.BlockID, 1, 0.0F); } } return(true); }
/// <summary> /// Called by a player entity when they collide with an entity /// </summary> public override void OnCollideWithPlayer(EntityPlayer par1EntityPlayer) { if (Func_40137_ah()) { int i = GetSlimeSize(); if (CanEntityBeSeen(par1EntityPlayer) && (double)GetDistanceToEntity(par1EntityPlayer) < 0.59999999999999998D * (double)i && par1EntityPlayer.AttackEntityFrom(DamageSource.CauseMobDamage(this), Func_40130_ai())) { WorldObj.PlaySoundAtEntity(this, "mob.slimeattack", 1.0F, (Rand.NextFloat() - Rand.NextFloat()) * 0.2F + 1.0F); } } }
/// <summary> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { base.OnUpdate(); if (PrevRotationPitch == 0.0F && PrevRotationYaw == 0.0F) { float f = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ); PrevRotationYaw = RotationYaw = (float)((Math.Atan2(MotionX, MotionZ) * 180D) / Math.PI); PrevRotationPitch = RotationPitch = (float)((Math.Atan2(MotionY, f) * 180D) / Math.PI); } int i = WorldObj.GetBlockId(XTile, YTile, ZTile); if (i > 0) { Block.BlocksList[i].SetBlockBoundsBasedOnState(WorldObj, XTile, YTile, ZTile); AxisAlignedBB axisalignedbb = Block.BlocksList[i].GetCollisionBoundingBoxFromPool(WorldObj, XTile, YTile, ZTile); if (axisalignedbb != null && axisalignedbb.IsVecInside(Vec3D.CreateVector(PosX, PosY, PosZ))) { InGround = true; } } if (ArrowShake > 0) { ArrowShake--; } if (InGround) { int j = WorldObj.GetBlockId(XTile, YTile, ZTile); int k = WorldObj.GetBlockMetadata(XTile, YTile, ZTile); if (j != InTile || k != InData) { InGround = false; MotionX *= Rand.NextFloat() * 0.2F; MotionY *= Rand.NextFloat() * 0.2F; MotionZ *= Rand.NextFloat() * 0.2F; TicksInGround = 0; TicksInAir = 0; return; } TicksInGround++; if (TicksInGround == 1200) { SetDead(); } return; } TicksInAir++; Vec3D vec3d = Vec3D.CreateVector(PosX, PosY, PosZ); Vec3D vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ); MovingObjectPosition movingobjectposition = WorldObj.RayTraceBlocks_do_do(vec3d, vec3d1, false, true); vec3d = Vec3D.CreateVector(PosX, PosY, PosZ); vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ); if (movingobjectposition != null) { vec3d1 = Vec3D.CreateVector(movingobjectposition.HitVec.XCoord, movingobjectposition.HitVec.YCoord, movingobjectposition.HitVec.ZCoord); } Entity entity = null; List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.AddCoord(MotionX, MotionY, MotionZ).Expand(1.0F, 1.0F, 1.0F)); double d = 0.0F; for (int l = 0; l < list.Count; l++) { Entity entity1 = list[l]; if (!entity1.CanBeCollidedWith() || entity1 == ShootingEntity && TicksInAir < 5) { continue; } float f5 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.BoundingBox.Expand(f5, f5, f5); MovingObjectPosition movingobjectposition1 = axisalignedbb1.CalculateIntercept(vec3d, vec3d1); if (movingobjectposition1 == null) { continue; } double d1 = vec3d.DistanceTo(movingobjectposition1.HitVec); if (d1 < d || d == 0.0F) { entity = entity1; d = d1; } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null) { if (movingobjectposition.EntityHit != null) { float f1 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionY * MotionY + MotionZ * MotionZ); int j1 = (int)Math.Ceiling((double)f1 * Damage); if (ArrowCritical) { j1 += Rand.Next(j1 / 2 + 2); } DamageSource damagesource = null; if (ShootingEntity == null) { damagesource = DamageSource.CauseArrowDamage(this, this); } else { damagesource = DamageSource.CauseArrowDamage(this, ShootingEntity); } if (IsBurning()) { movingobjectposition.EntityHit.SetFire(5); } if (movingobjectposition.EntityHit.AttackEntityFrom(damagesource, j1)) { if (movingobjectposition.EntityHit is EntityLiving) { ((EntityLiving)movingobjectposition.EntityHit).ArrowHitTempCounter++; if (Field_46027_au > 0) { float f7 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ); if (f7 > 0.0F) { movingobjectposition.EntityHit.AddVelocity((MotionX * Field_46027_au * 0.60000002384185791F) / f7, 0.10000000000000001F, (MotionZ * Field_46027_au * 0.60000002384185791F) / f7); } } } WorldObj.PlaySoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (Rand.NextFloat() * 0.2F + 0.9F)); SetDead(); } else { MotionX *= -0.10000000149011612F; MotionY *= -0.10000000149011612F; MotionZ *= -0.10000000149011612F; RotationYaw += 180F; PrevRotationYaw += 180F; TicksInAir = 0; } } else { XTile = movingobjectposition.BlockX; YTile = movingobjectposition.BlockY; ZTile = movingobjectposition.BlockZ; InTile = WorldObj.GetBlockId(XTile, YTile, ZTile); InData = WorldObj.GetBlockMetadata(XTile, YTile, ZTile); MotionX = (float)(movingobjectposition.HitVec.XCoord - PosX); MotionY = (float)(movingobjectposition.HitVec.YCoord - PosY); MotionZ = (float)(movingobjectposition.HitVec.ZCoord - PosZ); float f2 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionY * MotionY + MotionZ * MotionZ); PosX -= (MotionX / f2) * 0.05000000074505806F; PosY -= (MotionY / f2) * 0.05000000074505806F; PosZ -= (MotionZ / f2) * 0.05000000074505806F; WorldObj.PlaySoundAtEntity(this, "random.bowhit", 1.0F, 1.2F / (Rand.NextFloat() * 0.2F + 0.9F)); InGround = true; ArrowShake = 7; ArrowCritical = false; } } if (ArrowCritical) { for (int i1 = 0; i1 < 4; i1++) { WorldObj.SpawnParticle("crit", PosX + (MotionX * (double)i1) / 4D, PosY + (MotionY * (double)i1) / 4D, PosZ + (MotionZ * (double)i1) / 4D, -MotionX, -MotionY + 0.20000000000000001D, -MotionZ); } } PosX += MotionX; PosY += MotionY; PosZ += MotionZ; float f3 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ); RotationYaw = (float)((Math.Atan2(MotionX, MotionZ) * 180D) / Math.PI); for (RotationPitch = (float)((Math.Atan2(MotionY, f3) * 180D) / Math.PI); RotationPitch - PrevRotationPitch < -180F; PrevRotationPitch -= 360F) { } for (; RotationPitch - PrevRotationPitch >= 180F; PrevRotationPitch += 360F) { } for (; RotationYaw - PrevRotationYaw < -180F; PrevRotationYaw -= 360F) { } for (; RotationYaw - PrevRotationYaw >= 180F; PrevRotationYaw += 360F) { } RotationPitch = PrevRotationPitch + (RotationPitch - PrevRotationPitch) * 0.2F; RotationYaw = PrevRotationYaw + (RotationYaw - PrevRotationYaw) * 0.2F; float f4 = 0.99F; float f6 = 0.05F; if (IsInWater()) { for (int k1 = 0; k1 < 4; k1++) { float f8 = 0.25F; WorldObj.SpawnParticle("bubble", PosX - MotionX * (double)f8, PosY - MotionY * (double)f8, PosZ - MotionZ * (double)f8, MotionX, MotionY, MotionZ); } f4 = 0.8F; } MotionX *= f4; MotionY *= f4; MotionZ *= f4; MotionY -= f6; SetPosition(PosX, PosY, PosZ); }
/// <summary> /// Called when the mob's health reaches 0. /// </summary> public override void OnDeath(DamageSource par1DamageSource) { base.OnDeath(par1DamageSource); }
public override bool AttackEntityAsMob(Entity par1Entity) { sbyte byte0 = ((sbyte)(IsTamed() ? 4 : 2)); return(par1Entity.AttackEntityFrom(DamageSource.CauseMobDamage(this), byte0)); }
public override bool AttackEntityFromPart(EntityDragonPart par1EntityDragonPart, DamageSource par2DamageSource, int par3) { if (par1EntityDragonPart != DragonPartHead) { par3 = par3 / 4 + 1; } float f = (RotationYaw * (float)Math.PI) / 180F; float f1 = MathHelper2.Sin(f); float f2 = MathHelper2.Cos(f); TargetX = PosX + (f1 * 5F) + ((Rand.NextFloat() - 0.5F) * 2.0F); TargetY = PosY + (Rand.NextFloat() * 3F) + 1.0F; TargetZ = (PosZ - (f2 * 5F)) + ((Rand.NextFloat() - 0.5F) * 2.0F); Target = null; if ((par2DamageSource.GetEntity() is EntityPlayer) || par2DamageSource == DamageSource.Explosion) { SuperAttackFrom(par2DamageSource, par3); } return(true); }
/// <summary> /// Calculates de damage protection of the enchantment based on level and damage source passed. /// </summary> public virtual int CalcModifierDamage(int par1, DamageSource par2DamageSource) { return(0); }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { return(true); }
/// <summary> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { base.OnUpdate(); if (FishPosRotationIncrements > 0) { float d = PosX + (FishX - PosX) / FishPosRotationIncrements; float d1 = PosY + (FishY - PosY) / FishPosRotationIncrements; float d2 = PosZ + (FishZ - PosZ) / FishPosRotationIncrements; double d4; for (d4 = FishYaw - RotationYaw; d4 < -180D; d4 += 360D) { } for (; d4 >= 180D; d4 -= 360D) { } RotationYaw += (float)d4 / FishPosRotationIncrements; RotationPitch += (float)(FishPitch - RotationPitch) / FishPosRotationIncrements; FishPosRotationIncrements--; SetPosition(d, d1, d2); SetRotation(RotationYaw, RotationPitch); return; } if (!WorldObj.IsRemote) { ItemStack itemstack = Angler.GetCurrentEquippedItem(); if (Angler.IsDead || !Angler.IsEntityAlive() || itemstack == null || itemstack.GetItem() != Item.FishingRod || GetDistanceSqToEntity(Angler) > 1024D) { SetDead(); Angler.FishEntity = null; return; } if (Bobber != null) { if (Bobber.IsDead) { Bobber = null; } else { PosX = Bobber.PosX; PosY = Bobber.BoundingBox.MinY + Bobber.Height * 0.80000000000000004F; PosZ = Bobber.PosZ; return; } } } if (Shake > 0) { Shake--; } if (InGround) { int i = WorldObj.GetBlockId(XTile, YTile, ZTile); if (i != InTile) { InGround = false; MotionX *= Rand.NextFloat() * 0.2F; MotionY *= Rand.NextFloat() * 0.2F; MotionZ *= Rand.NextFloat() * 0.2F; TicksInGround = 0; TicksInAir = 0; } else { TicksInGround++; if (TicksInGround == 1200) { SetDead(); } return; } } else { TicksInAir++; } Vec3D vec3d = Vec3D.CreateVector(PosX, PosY, PosZ); Vec3D vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ); MovingObjectPosition movingobjectposition = WorldObj.RayTraceBlocks(vec3d, vec3d1); vec3d = Vec3D.CreateVector(PosX, PosY, PosZ); vec3d1 = Vec3D.CreateVector(PosX + MotionX, PosY + MotionY, PosZ + MotionZ); if (movingobjectposition != null) { vec3d1 = Vec3D.CreateVector(movingobjectposition.HitVec.XCoord, movingobjectposition.HitVec.YCoord, movingobjectposition.HitVec.ZCoord); } Entity entity = null; List <Entity> list = WorldObj.GetEntitiesWithinAABBExcludingEntity(this, BoundingBox.AddCoord(MotionX, MotionY, MotionZ).Expand(1.0F, 1.0F, 1.0F)); double d3 = 0.0F; for (int j = 0; j < list.Count; j++) { Entity entity1 = list[j]; if (!entity1.CanBeCollidedWith() || entity1 == Angler && TicksInAir < 5) { continue; } float f2 = 0.3F; AxisAlignedBB axisalignedbb = entity1.BoundingBox.Expand(f2, f2, f2); MovingObjectPosition movingobjectposition1 = axisalignedbb.CalculateIntercept(vec3d, vec3d1); if (movingobjectposition1 == null) { continue; } double d6 = vec3d.DistanceTo(movingobjectposition1.HitVec); if (d6 < d3 || d3 == 0.0F) { entity = entity1; d3 = d6; } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null) { if (movingobjectposition.EntityHit != null) { if (movingobjectposition.EntityHit.AttackEntityFrom(DamageSource.CauseThrownDamage(this, Angler), 0)) { Bobber = movingobjectposition.EntityHit; } } else { InGround = true; } } if (InGround) { return; } MoveEntity(MotionX, MotionY, MotionZ); float f = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ); RotationYaw = (float)((Math.Atan2(MotionX, MotionZ) * 180D) / Math.PI); for (RotationPitch = (float)((Math.Atan2(MotionY, f) * 180D) / Math.PI); RotationPitch - PrevRotationPitch < -180F; PrevRotationPitch -= 360F) { } for (; RotationPitch - PrevRotationPitch >= 180F; PrevRotationPitch += 360F) { } for (; RotationYaw - PrevRotationYaw < -180F; PrevRotationYaw -= 360F) { } for (; RotationYaw - PrevRotationYaw >= 180F; PrevRotationYaw += 360F) { } RotationPitch = PrevRotationPitch + (RotationPitch - PrevRotationPitch) * 0.2F; RotationYaw = PrevRotationYaw + (RotationYaw - PrevRotationYaw) * 0.2F; float f1 = 0.92F; if (OnGround || IsCollidedHorizontally) { f1 = 0.5F; } int k = 5; float d5 = 0.0F; for (int l = 0; l < k; l++) { float d8 = ((BoundingBox.MinY + ((BoundingBox.MaxY - BoundingBox.MinY) * (l + 0)) / k) - 0.125F) + 0.125F; float d9 = ((BoundingBox.MinY + ((BoundingBox.MaxY - BoundingBox.MinY) * (l + 1)) / k) - 0.125F) + 0.125F; AxisAlignedBB axisalignedbb1 = AxisAlignedBB.GetBoundingBoxFromPool(BoundingBox.MinX, d8, BoundingBox.MinZ, BoundingBox.MaxX, d9, BoundingBox.MaxZ); if (WorldObj.IsAABBInMaterial(axisalignedbb1, Material.Water)) { d5 += 1.0F / k; } } if (d5 > 0.0F) { if (TicksCatchable > 0) { TicksCatchable--; } else { int c = 500; if (WorldObj.CanLightningStrikeAt(MathHelper2.Floor_double(PosX), MathHelper2.Floor_double(PosY) + 1, MathHelper2.Floor_double(PosZ))) { c = 300; } if (Rand.Next(c) == 0) { TicksCatchable = Rand.Next(30) + 10; MotionY -= 0.20000000298023224F; WorldObj.PlaySoundAtEntity(this, "random.splash", 0.25F, 1.0F + (Rand.NextFloat() - Rand.NextFloat()) * 0.4F); float f3 = MathHelper2.Floor_double(BoundingBox.MinY); for (int i1 = 0; (float)i1 < 1.0F + Width * 20F; i1++) { float f4 = (Rand.NextFloat() * 2.0F - 1.0F) * Width; float f6 = (Rand.NextFloat() * 2.0F - 1.0F) * Width; WorldObj.SpawnParticle("bubble", PosX + f4, f3 + 1.0F, PosZ + f6, MotionX, MotionY - (Rand.NextFloat() * 0.2F), MotionZ); } for (int j1 = 0; (float)j1 < 1.0F + Width * 20F; j1++) { float f5 = (Rand.NextFloat() * 2.0F - 1.0F) * Width; float f7 = (Rand.NextFloat() * 2.0F - 1.0F) * Width; WorldObj.SpawnParticle("splash", PosX + f5, f3 + 1.0F, PosZ + f7, MotionX, MotionY, MotionZ); } } } } if (TicksCatchable > 0) { MotionY -= (Rand.NextFloat() * Rand.NextFloat() * Rand.NextFloat()) * 0.20000000000000001F; } float d7 = d5 * 2F - 1.0F; MotionY += 0.039999999105930328F * d7; if (d5 > 0.0F) { f1 = (float)((double)f1 * 0.90000000000000002D); MotionY *= 0.80000000000000004F; } MotionX *= f1; MotionY *= f1; MotionZ *= f1; SetPosition(PosX, PosY, PosZ); }
/// <summary> /// Returns the modifier of protection enchantments on armors equipped on player. /// </summary> public static int GetEnchantmentModifierDamage(InventoryPlayer par0InventoryPlayer, DamageSource par1DamageSource) { EnchantmentModifierDamage.DamageModifier = 0; EnchantmentModifierDamage.DamageSource = par1DamageSource; ApplyEnchantmentModifierArray(EnchantmentModifierDamage, par0InventoryPlayer.ArmorInventory); if (EnchantmentModifierDamage.DamageModifier > 25) { EnchantmentModifierDamage.DamageModifier = 25; } return((EnchantmentModifierDamage.DamageModifier + 1 >> 1) + EnchantmentRand.Next((EnchantmentModifierDamage.DamageModifier >> 1) + 1)); }
public override bool AttackEntityAsMob(Entity par1Entity) { return(par1Entity.AttackEntityFrom(DamageSource.CauseMobDamage(this), 3)); }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { AiSit.Func_48407_a(false); return(base.AttackEntityFrom(par1DamageSource, par2)); }
/// <summary> /// Called when the entity is attacked. /// </summary> public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2) { return(base.AttackEntityFrom(par1DamageSource, par2)); }