/// <summary> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { base.OnUpdate(); byte byte0 = DataWatcher.GetWatchableObjectByte(16); Texture = byte0 != 1 ? "/mob/ghast.png" : "/mob/ghast_fire.png"; }
protected override void EntityInit() { DataWatcher.AddObject(16, new byte?((byte)0)); DataWatcher.AddObject(17, new int?(0)); DataWatcher.AddObject(18, new int?(1)); DataWatcher.AddObject(19, new int?(0)); }
public virtual void SetSlimeSize(int par1) { DataWatcher.UpdateObject(16, new sbyte?((sbyte)par1)); SetSize(0.6F * (float)par1, 0.6F * (float)par1); SetPosition(PosX, PosY, PosZ); SetEntityHealth(GetMaxHealth()); ExperienceValue = par1; }
/// <summary> /// (abstract) Protected helper method to write subclass entity data to NBT. /// </summary> public override void WriteEntityToNBT(NBTTagCompound par1NBTTagCompound) { base.WriteEntityToNBT(par1NBTTagCompound); if (DataWatcher.GetWatchableObjectByte(17) == 1) { par1NBTTagCompound.Setbool("powered", true); } }
/// <summary> /// Set or remove the saddle of the pig. /// </summary> public virtual void SetSaddled(bool par1) { if (par1) { DataWatcher.UpdateObject(16, Convert.ToByte((sbyte)1)); } else { DataWatcher.UpdateObject(16, Convert.ToByte((sbyte)0)); } }
/// <summary> /// Set if this minecart is powered (Fuel > 0) /// </summary> protected virtual void SetMinecartPowered(bool par1) { if (par1) { DataWatcher.UpdateObject(16, DataWatcher.GetWatchableObjectByte(16) | 1); } else { DataWatcher.UpdateObject(16, DataWatcher.GetWatchableObjectByte(16) & -2); } }
public Packet24MobSpawn(EntityLiving par1EntityLiving) { EntityId = par1EntityLiving.EntityId; Type = (sbyte)EntityList.GetEntityID(par1EntityLiving); XPosition = MathHelper2.Floor_double(par1EntityLiving.PosX * 32D); YPosition = MathHelper2.Floor_double(par1EntityLiving.PosY * 32D); ZPosition = MathHelper2.Floor_double(par1EntityLiving.PosZ * 32D); Yaw = (sbyte)(int)((par1EntityLiving.RotationYaw * 256F) / 360F); Pitch = (sbyte)(int)((par1EntityLiving.RotationPitch * 256F) / 360F); Field_48169_h = (sbyte)(int)((par1EntityLiving.RotationYawHead * 256F) / 360F); MetaData = par1EntityLiving.GetDataWatcher(); }
/// <summary> /// Abstract. Reads the raw packet data from the data stream. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void readPacketData(BinaryReader par1NetworkStream) throws IOException public override void ReadPacketData(BinaryReader par1NetworkStream) { EntityId = par1NetworkStream.ReadInt32(); Type = par1NetworkStream.ReadByte() & 0xff; XPosition = par1NetworkStream.ReadInt32(); YPosition = par1NetworkStream.ReadInt32(); ZPosition = par1NetworkStream.ReadInt32(); Yaw = (sbyte)par1NetworkStream.ReadByte(); Pitch = (sbyte)par1NetworkStream.ReadByte(); Field_48169_h = (sbyte)par1NetworkStream.ReadByte(); ReceivedMetadata = DataWatcher.ReadWatchableObjects(par1NetworkStream); }
public virtual void SetTamed(bool par1) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); if (par1) { DataWatcher.UpdateObject(16, byte0 | 4); } else { DataWatcher.UpdateObject(16, byte0 & -5); } }
public virtual void Func_48140_f(bool par1) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); if (par1) { DataWatcher.UpdateObject(16, byte0 | 1); } else { DataWatcher.UpdateObject(16, byte0 & -2); } }
/// <summary> /// sets this wolf's angry state to true if the bool argument is true /// </summary> public virtual void SetAngry(bool par1) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); if (par1) { DataWatcher.UpdateObject(16, byte0 | 2); } else { DataWatcher.UpdateObject(16, byte0 & -3); } }
/// <summary> /// make a sheep sheared if set to true /// </summary> public virtual void SetSheared(bool par1) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); if (par1) { DataWatcher.UpdateObject(16, Convert.ToByte((sbyte)(byte0 | 0x10))); } else { DataWatcher.UpdateObject(16, Convert.ToByte((sbyte)(byte0 & 0xffffffef))); } }
public virtual void Func_40148_a(bool par1) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); if (par1) { byte0 |= 1; } else { byte0 &= 0xfe; } DataWatcher.UpdateObject(16, byte0); }
public virtual float GetTailRotation() { if (IsAngry()) { return(1.53938F); } if (IsTamed()) { return((0.55F - (float)(20 - DataWatcher.GetWatchableObjectInt(18)) * 0.02F) * (float)Math.PI); } else { return((float)Math.PI / 5F); } }
/// <summary> /// Called to update the entity's position/logic. /// </summary> public override void OnUpdate() { PrevPosX = PosX; PrevPosY = PosY; PrevPosZ = PosZ; InnerRotation++; DataWatcher.UpdateObject(8, Convert.ToInt32(Health)); int i = MathHelper2.Floor_double(PosX); int j = MathHelper2.Floor_double(PosY); int k = MathHelper2.Floor_double(PosZ); if (WorldObj.GetBlockId(i, j, k) != Block.Fire.BlockID) { WorldObj.SetBlockWithNotify(i, j, k, Block.Fire.BlockID); } }
/// <summary> /// Returns the sound this mob makes while it's alive. /// </summary> protected override string GetLivingSound() { if (IsAngry()) { return("mob.wolf.growl"); } if (Rand.Next(3) == 0) { if (IsTamed() && DataWatcher.GetWatchableObjectInt(18) < 10) { return("mob.wolf.whine"); } else { return("mob.wolf.panting"); } } else { return("mob.wolf.bark"); } }
protected override void EntityInit() { base.EntityInit(); DataWatcher.AddObject(12, new int?(0)); }
protected override void EntityInit() { base.EntityInit(); DataWatcher.AddObject(16, Convert.ToInt32(0)); }
public virtual int GetProfession() { return(DataWatcher.GetWatchableObjectInt(16)); }
public virtual void SetProfession(int par1) { DataWatcher.UpdateObject(16, Convert.ToInt32(par1)); }
public override void UpdateEntityActionState() { if (!WorldObj.IsRemote && WorldObj.DifficultySetting == 0) { SetDead(); } DespawnEntity(); PrevAttackCounter = AttackCounter; float d = WaypointX - PosX; float d1 = WaypointY - PosY; float d2 = WaypointZ - PosZ; float d3 = (float)MathHelper2.Sqrt_double(d * d + d1 * d1 + d2 * d2); if (d3 < 1.0D || d3 > 60D) { WaypointX = PosX + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); WaypointY = PosY + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); WaypointZ = PosZ + ((Rand.NextFloat() * 2.0F - 1.0F) * 16F); } if (CourseChangeCooldown-- <= 0) { CourseChangeCooldown += Rand.Next(5) + 2; if (IsCourseTraversable(WaypointX, WaypointY, WaypointZ, d3)) { MotionX += (d / d3) * 0.10000000000000001F; MotionY += (d1 / d3) * 0.10000000000000001F; MotionZ += (d2 / d3) * 0.10000000000000001F; } else { WaypointX = PosX; WaypointY = PosY; WaypointZ = PosZ; } } if (TargetedEntity != null && TargetedEntity.IsDead) { TargetedEntity = null; } if (TargetedEntity == null || AggroCooldown-- <= 0) { TargetedEntity = WorldObj.GetClosestVulnerablePlayerToEntity(this, 100); if (TargetedEntity != null) { AggroCooldown = 20; } } double d4 = 64D; if (TargetedEntity != null && TargetedEntity.GetDistanceSqToEntity(this) < d4 * d4) { float d5 = TargetedEntity.PosX - PosX; float d6 = (TargetedEntity.BoundingBox.MinY + TargetedEntity.Height / 2.0F) - PosY + (Height / 2.0F); float d7 = TargetedEntity.PosZ - PosZ; RenderYawOffset = RotationYaw = (-(float)Math.Atan2(d5, d7) * 180F) / (float)Math.PI; if (CanEntityBeSeen(TargetedEntity)) { if (AttackCounter == 10) { WorldObj.PlayAuxSFXAtEntity(null, 1007, (int)PosX, (int)PosY, (int)PosZ, 0); } AttackCounter++; if (AttackCounter == 20) { WorldObj.PlayAuxSFXAtEntity(null, 1008, (int)PosX, (int)PosY, (int)PosZ, 0); EntityFireball entityfireball = new EntityFireball(WorldObj, this, d5, d6, d7); float d8 = 4; Vec3D vec3d = GetLook(1.0F); entityfireball.PosX = PosX + (float)vec3d.XCoord * d8; entityfireball.PosY = PosY + (Height / 2.0F) + 0.5F; entityfireball.PosZ = PosZ + (float)vec3d.ZCoord * d8; WorldObj.SpawnEntityInWorld(entityfireball); AttackCounter = -40; } } else if (AttackCounter > 0) { AttackCounter--; } } else { RenderYawOffset = RotationYaw = (-(float)Math.Atan2(MotionX, MotionZ) * 180F) / (float)Math.PI; if (AttackCounter > 0) { AttackCounter--; } } if (!WorldObj.IsRemote) { byte byte0 = DataWatcher.GetWatchableObjectByte(16); byte byte1 = (byte)(AttackCounter <= 10 ? 0 : 1); if (byte0 != byte1) { DataWatcher.UpdateObject(16, byte1); } } }
public virtual void Func_41029_h(int par1) { DataWatcher.UpdateObject(18, par1); }
public virtual int Func_41010_ax() { return(DataWatcher.GetWatchableObjectInt(16)); }
protected override void EntityInit() { base.EntityInit(); DataWatcher.AddObject(16, new int?(MaxHealth)); }
/// <summary> /// Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons /// use this to react to sunlight and start to burn. /// </summary> public override void OnLivingUpdate() { Field_40173_aw = Field_40172_ax; if (!WorldObj.IsRemote) { DataWatcher.UpdateObject(16, Convert.ToInt32(Health)); } if (Health <= 0) { float f = (Rand.NextFloat() - 0.5F) * 8F; float f2 = (Rand.NextFloat() - 0.5F) * 4F; float f4 = (Rand.NextFloat() - 0.5F) * 8F; WorldObj.SpawnParticle("largeexplode", PosX + (double)f, PosY + 2D + (double)f2, PosZ + (double)f4, 0.0F, 0.0F, 0.0F); return; } UpdateDragonEnderCrystal(); float f1 = 0.2F / (MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ) * 10F + 1.0F); f1 *= (float)Math.Pow(2D, MotionY); if (Field_40161_az) { Field_40172_ax += f1 * 0.5F; } else { Field_40172_ax += f1; } for (; RotationYaw >= 180F; RotationYaw -= 360F) { } for (; RotationYaw < -180F; RotationYaw += 360F) { } if (Field_40164_e < 0) { for (int i = 0; i < Field_40162_d.Length; i++) { Field_40162_d[i][0] = RotationYaw; Field_40162_d[i][1] = PosY; } } if (++Field_40164_e == Field_40162_d.Length) { Field_40164_e = 0; } Field_40162_d[Field_40164_e][0] = RotationYaw; Field_40162_d[Field_40164_e][1] = PosY; if (WorldObj.IsRemote) { if (NewPosRotationIncrements > 0) { float d = PosX + (NewPosX - PosX) / NewPosRotationIncrements; float d2 = PosY + (NewPosY - PosY) / NewPosRotationIncrements; float d4 = PosZ + (NewPosZ - PosZ) / NewPosRotationIncrements; double d6; for (d6 = NewRotationYaw - (double)RotationYaw; d6 < -180D; d6 += 360D) { } for (; d6 >= 180D; d6 -= 360D) { } RotationYaw += (float)d6 / NewPosRotationIncrements; RotationPitch += (float)(NewRotationPitch - RotationPitch) / NewPosRotationIncrements; NewPosRotationIncrements--; SetPosition(d, d2, d4); SetRotation(RotationYaw, RotationPitch); } } else { double d1 = TargetX - PosX; float d3 = TargetY - PosY; double d5 = TargetZ - PosZ; double d7 = d1 * d1 + d3 * d3 + d5 * d5; if (Target != null) { TargetX = Target.PosX; TargetZ = Target.PosZ; float d8 = TargetX - PosX; float d10 = TargetZ - PosZ; float d12 = (float)Math.Sqrt(d8 * d8 + d10 * d10); float d13 = (0.40000000596046448F + d12 / 80F) - 1.0F; if (d13 > 10F) { d13 = 10F; } TargetY = Target.BoundingBox.MinY + d13; } else { TargetX += Rand.NextGaussian() * 2F; TargetZ += Rand.NextGaussian() * 2F; } if (Field_40163_ay || d7 < 100D || d7 > 22500D || IsCollidedHorizontally || IsCollidedVertically) { Func_41006_aA(); } d3 /= MathHelper2.Sqrt_double(d1 * d1 + d5 * d5); float f10 = 0.6F; if (d3 < (double)(-f10)) { d3 = -f10; } if (d3 > (double)f10) { d3 = f10; } MotionY += d3 * 0.10000000149011612F; for (; RotationYaw < -180F; RotationYaw += 360F) { } for (; RotationYaw >= 180F; RotationYaw -= 360F) { } double d9 = 180D - (Math.Atan2(d1, d5) * 180D) / Math.PI; double d11; for (d11 = d9 - (double)RotationYaw; d11 < -180D; d11 += 360D) { } for (; d11 >= 180D; d11 -= 360D) { } if (d11 > 50D) { d11 = 50D; } if (d11 < -50D) { d11 = -50D; } Vec3D vec3d = Vec3D.CreateVector(TargetX - PosX, TargetY - PosY, TargetZ - PosZ).Normalize(); Vec3D vec3d1 = Vec3D.CreateVector(MathHelper2.Sin((RotationYaw * (float)Math.PI) / 180F), MotionY, -MathHelper2.Cos((RotationYaw * (float)Math.PI) / 180F)).Normalize(); float f18 = (float)(vec3d1.DotProduct(vec3d) + 0.5D) / 1.5F; if (f18 < 0.0F) { f18 = 0.0F; } RandomYawVelocity *= 0.8F; float f19 = MathHelper2.Sqrt_double(MotionX * MotionX + MotionZ * MotionZ) * 1.0F + 1.0F; double d14 = Math.Sqrt(MotionX * MotionX + MotionZ * MotionZ) * 1.0D + 1.0D; if (d14 > 40D) { d14 = 40D; } RandomYawVelocity += (float)(d11 * (0.69999998807907104D / d14 / f19)); RotationYaw += RandomYawVelocity * 0.1F; float f20 = (float)(2D / (d14 + 1.0D)); float f21 = 0.06F; MoveFlying(0.0F, -1F, f21 * (f18 * f20 + (1.0F - f20))); if (Field_40161_az) { MoveEntity(MotionX * 0.80000001192092896F, MotionY * 0.80000001192092896F, MotionZ * 0.80000001192092896F); } else { MoveEntity(MotionX, MotionY, MotionZ); } Vec3D vec3d2 = Vec3D.CreateVector(MotionX, MotionY, MotionZ).Normalize(); float f22 = (float)(vec3d2.DotProduct(vec3d1) + 1.0D) / 2.0F; f22 = 0.8F + 0.15F * f22; MotionX *= f22; MotionZ *= f22; MotionY *= 0.9100000262260437F; } RenderYawOffset = RotationYaw; DragonPartHead.Width = DragonPartHead.Height = 3F; DragonPartTail1.Width = DragonPartTail1.Height = 2.0F; DragonPartTail2.Width = DragonPartTail2.Height = 2.0F; DragonPartTail3.Width = DragonPartTail3.Height = 2.0F; DragonPartBody.Height = 3F; DragonPartBody.Width = 5F; DragonPartWing1.Height = 2.0F; DragonPartWing1.Width = 4F; DragonPartWing2.Height = 3F; DragonPartWing2.Width = 4F; float f3 = (((float)(Func_40160_a(5, 1.0F)[1] - Func_40160_a(10, 1.0F)[1]) * 10F) / 180F) * (float)Math.PI; float f5 = MathHelper2.Cos(f3); float f6 = -MathHelper2.Sin(f3); float f7 = (RotationYaw * (float)Math.PI) / 180F; float f8 = MathHelper2.Sin(f7); float f9 = MathHelper2.Cos(f7); DragonPartBody.OnUpdate(); DragonPartBody.SetLocationAndAngles(PosX + (f8 * 0.5F), PosY, PosZ - (f9 * 0.5F), 0.0F, 0.0F); DragonPartWing1.OnUpdate(); DragonPartWing1.SetLocationAndAngles(PosX + (f9 * 4.5F), PosY + 2F, PosZ + (f8 * 4.5F), 0.0F, 0.0F); DragonPartWing2.OnUpdate(); DragonPartWing2.SetLocationAndAngles(PosX - (f9 * 4.5F), PosY + 2F, PosZ - (f8 * 4.5F), 0.0F, 0.0F); if (!WorldObj.IsRemote) { Func_41007_az(); } if (!WorldObj.IsRemote && MaxHurtTime == 0) { CollideWithEntities(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartWing1.BoundingBox.Expand(4, 2, 4).Offset(0.0F, -2F, 0.0F))); CollideWithEntities(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartWing2.BoundingBox.Expand(4, 2, 4).Offset(0.0F, -2F, 0.0F))); AttackEntitiesInList(WorldObj.GetEntitiesWithinAABBExcludingEntity(this, DragonPartHead.BoundingBox.Expand(1.0F, 1.0F, 1.0F))); } float[] ad = Func_40160_a(5, 1.0F); float[] ad1 = Func_40160_a(0, 1.0F); float f11 = MathHelper2.Sin((RotationYaw * (float)Math.PI) / 180F - RandomYawVelocity * 0.01F); float f12 = MathHelper2.Cos((RotationYaw * (float)Math.PI) / 180F - RandomYawVelocity * 0.01F); DragonPartHead.OnUpdate(); DragonPartHead.SetLocationAndAngles(PosX + (f11 * 5.5F * f5), PosY + (ad1[1] - ad[1]) * 1.0F + (f6 * 5.5F), PosZ - (f12 * 5.5F * f5), 0.0F, 0.0F); for (int j = 0; j < 3; j++) { EntityDragonPart entitydragonpart = null; if (j == 0) { entitydragonpart = DragonPartTail1; } if (j == 1) { entitydragonpart = DragonPartTail2; } if (j == 2) { entitydragonpart = DragonPartTail3; } float[] ad2 = Func_40160_a(12 + j * 2, 1.0F); float f13 = (RotationYaw * (float)Math.PI) / 180F + ((SimplifyAngle(ad2[0] - ad[0]) * (float)Math.PI) / 180F) * 1.0F; float f14 = MathHelper2.Sin(f13); float f15 = MathHelper2.Cos(f13); float f16 = 1.5F; float f17 = (float)(j + 1) * 2.0F; entitydragonpart.OnUpdate(); entitydragonpart.SetLocationAndAngles(PosX - ((f8 * f16 + f14 * f17) * f5), ((PosY + (ad2[1] - ad[1]) * 1.0F) - ((f17 + f16) * f6)) + 1.5F, PosZ + ((f9 * f16 + f15 * f17) * f5), 0.0F, 0.0F); } if (!WorldObj.IsRemote) { Field_40161_az = DestroyBlocksInAABB(DragonPartHead.BoundingBox) | DestroyBlocksInAABB(DragonPartBody.BoundingBox); } }
public virtual int Func_41030_m() { return(DataWatcher.GetWatchableObjectInt(18)); }
/// <summary> /// The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's /// positive, it get's decremented each tick. Don't confuse this with EntityLiving.getAge. With a negative value the /// Entity is considered a child. /// </summary> public virtual int GetGrowingAge() { return(DataWatcher.GetWatchableObjectInt(12)); }
protected override void EntityInit() { base.EntityInit(); DataWatcher.AddObject(16, Convert.ToByte((sbyte)0)); }
/// <summary> /// The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's /// positive, it get's decremented each tick. With a negative value the Entity is considered a child. /// </summary> public virtual void SetGrowingAge(int par1) { DataWatcher.UpdateObject(12, Convert.ToInt32(par1)); }
public virtual int Func_41023_l() { return(DataWatcher.GetWatchableObjectInt(17)); }