/// <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";
        }
        /// <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);
            }
        }
예제 #3
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);
     }
 }
        /// <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 SetTamed(bool par1)
        {
            byte byte0 = DataWatcher.GetWatchableObjectByte(16);

            if (par1)
            {
                DataWatcher.UpdateObject(16, byte0 | 4);
            }
            else
            {
                DataWatcher.UpdateObject(16, byte0 & -5);
            }
        }
        /// <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);
            }
        }
        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);
            }
        }
        public virtual void Func_40148_a(bool par1)
        {
            byte byte0 = DataWatcher.GetWatchableObjectByte(16);

            if (par1)
            {
                byte0 |= 1;
            }
            else
            {
                byte0 &= 0xfe;
            }

            DataWatcher.UpdateObject(16, byte0);
        }
예제 #9
0
 /// <summary>
 /// Get the id of the block an enderman carries
 /// </summary>
 public virtual int GetCarried()
 {
     return(DataWatcher.GetWatchableObjectByte(16));
 }
 public virtual bool IsTamed()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 4) != 0);
 }
 public virtual bool IsSitting()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 1) != 0);
 }
예제 #12
0
 /// <summary>
 /// Returns the size of the slime.
 /// </summary>
 public virtual int GetSlimeSize()
 {
     return(DataWatcher.GetWatchableObjectByte(16));
 }
예제 #13
0
 /// <summary>
 /// Returns true if the pig is saddled.
 /// </summary>
 public virtual bool GetSaddled()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 1) != 0);
 }
예제 #14
0
 public virtual int Func_48148_ad()
 {
     return(DataWatcher.GetWatchableObjectByte(18));
 }
        public virtual void SetFleeceColor(int par1)
        {
            byte byte0 = DataWatcher.GetWatchableObjectByte(16);

            DataWatcher.UpdateObject(16, Convert.ToByte((sbyte)(byte0 & 0xf0 | par1 & 0xf)));
        }
 /// <summary>
 /// returns true if a sheeps wool has been sheared
 /// </summary>
 public virtual bool GetSheared()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 0x10) != 0);
 }
예제 #17
0
 /// <summary>
 /// Is this minecart powered (Fuel > 0)
 /// </summary>
 protected virtual bool IsMinecartPowered()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 1) != 0);
 }
예제 #18
0
 /// <summary>
 /// gets this wolf's angry state
 /// </summary>
 public virtual bool IsAngry()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 2) != 0);
 }
 /// <summary>
 /// Returns true if the creeper is powered by a lightning bolt.
 /// </summary>
 public virtual bool GetPowered()
 {
     return(DataWatcher.GetWatchableObjectByte(17) == 1);
 }
 /// <summary>
 /// Returns the current state of creeper, -1 is idle, 1 is 'in fuse'
 /// </summary>
 public virtual int GetCreeperState()
 {
     return(DataWatcher.GetWatchableObjectByte(16));
 }
예제 #21
0
 /// <summary>
 /// Get the metadata of the block an enderman carries
 /// </summary>
 public virtual int GetCarryingData()
 {
     return(DataWatcher.GetWatchableObjectByte(17));
 }
 public virtual bool Func_48112_E_()
 {
     return((DataWatcher.GetWatchableObjectByte(16) & 1) != 0);
 }
        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 int GetFleeceColor()
 {
     return(DataWatcher.GetWatchableObjectByte(16) & 0xf);
 }