Ejemplo n.º 1
0
        public override MetadataDictionary GetMetadata()
        {
            var metadata = base.GetMetadata();
            metadata[14] = new MetadataByte((byte) (IsBayby ? 1 : 0));

            return metadata;
        }
Ejemplo n.º 2
0
		public override MetadataDictionary GetMetadata()
		{
			MetadataDictionary metadata = new MetadataDictionary();
			metadata[16] = new MetadataByte(Fuse);

			return metadata;
		}
Ejemplo n.º 3
0
        public override MetadataDictionary GetMetadata()
        {
            MetadataDictionary metadata = base.GetMetadata();
            metadata[18] = new MetadataInt(IsAngry ? 1 : 0);
            metadata[20] = new MetadataByte(CollarColor);

            return metadata;
        }
Ejemplo n.º 4
0
		public virtual MetadataDictionary GetMetadata()
		{
			MetadataDictionary metadata = new MetadataDictionary();
			metadata[0] = new MetadataByte((byte) (HealthManager.IsOnFire ? 1 : 0));
			metadata[1] = new MetadataShort(HealthManager.Air);
			metadata[2] = new MetadataString(NameTag ?? string.Empty);
			metadata[3] = new MetadataByte(1);
			metadata[4] = new MetadataByte(0);
			metadata[15] = new MetadataByte(0);
			//metadata[16] = new MetadataByte(0);

			return metadata;
		}
Ejemplo n.º 5
0
		public override MetadataDictionary GetMetadata()
		{
			MetadataDictionary metadata = new MetadataDictionary();
			metadata[0] = new MetadataByte((byte) (HealthManager.IsOnFire ? 1 : 0));
			metadata[1] = new MetadataShort(HealthManager.Air);
			metadata[2] = new MetadataString(NameTag ?? Name);
			metadata[3] = new MetadataByte(!HideNameTag);
			metadata[4] = new MetadataByte(Silent);
			metadata[7] = new MetadataInt(0); // Potion Color
			metadata[8] = new MetadataByte(0); // Potion Ambient
			metadata[15] = new MetadataByte(NoAi);
			metadata[16] = new MetadataByte(0); // Player flags
			//metadata[17] = new MetadataIntCoordinates(0, 0, 0);

			return metadata;
		}
Ejemplo n.º 6
0
 public override MetadataDictionary GetMetadata()
 {
     var metadata = base.GetMetadata();
     metadata[15] = new MetadataByte(1);
     return metadata;
 }
Ejemplo n.º 7
0
		public override MetadataDictionary GetMetadata()
		{
			MetadataDictionary metadata = new MetadataDictionary();
			metadata[0] = new MetadataByte(GetDataValue());
			metadata[1] = new MetadataShort(HealthManager.Air);
			metadata[2] = new MetadataString("\u2764 \u2665 " + (NameTag ?? Username));
			metadata[3] = new MetadataByte(!HideNameTag);
			metadata[4] = new MetadataByte(Silent);
			metadata[7] = new MetadataInt(0); // Potion Color
			metadata[8] = new MetadataByte(0); // Potion Ambient
			metadata[15] = new MetadataByte(NoAi);
			metadata[16] = new MetadataByte(0); // Player flags
			metadata[17] = new MetadataIntCoordinates(0, 0, 0);

			return metadata;
		}
Ejemplo n.º 8
0
        protected virtual void HandleUseItem(McpeUseItem message)
        {
            Log.DebugFormat("Use item: {0}", message.item);
            Log.DebugFormat("Entity ID: {0}", message.entityId);
            Log.DebugFormat("meta:  {0}", message.meta);
            Log.DebugFormat("x:  {0}", message.x);
            Log.DebugFormat("y:  {0}", message.y);
            Log.DebugFormat("z:  {0}", message.z);
            Log.DebugFormat("face:  {0}", message.face);
            Log.DebugFormat("fx:  {0}", message.fx);
            Log.DebugFormat("fy:  {0}", message.fy);
            Log.DebugFormat("fz:  {0}", message.fz);
            Log.DebugFormat("px:  {0}", message.positionX);
            Log.DebugFormat("py:  {0}", message.positionY);
            Log.DebugFormat("pz:  {0}", message.positionZ);

            if (message.face <= 5)
            {
                Level.RelayBroadcast(this, new McpeAnimate()
                {
                    actionId = 1,
                    entityId = EntityId
                });

                Vector3 faceCoords = new Vector3(message.fx, message.fy, message.fz);

                Level.Interact(Level, this, message.item, new BlockCoordinates(message.x, message.y, message.z), message.meta, (BlockFace) message.face, faceCoords);
            }
            else
            {
                _itemUseTimer = new Stopwatch();
                _itemUseTimer.Start();
                // Snowballs and shit
                Level.Interact(Level, this, message.item, new BlockCoordinates(message.x, message.y, message.z), message.meta);

                MetadataDictionary metadata = new MetadataDictionary();
                metadata[0] = new MetadataByte(16);
                Level.RelayBroadcast(this, new McpeSetEntityData
                {
                    entityId = EntityId,
                    metadata = metadata,
                });
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     Handles the player action.
        /// </summary>
        /// <param name="message">The message.</param>
        protected virtual void HandlePlayerAction(McpePlayerAction message)
        {
            Log.DebugFormat("Player action: {0}", message.actionId);
            Log.DebugFormat("Entity ID: {0}", message.entityId);
            Log.DebugFormat("Action ID:  {0}", message.actionId);
            Log.DebugFormat("x:  {0}", message.x);
            Log.DebugFormat("y:  {0}", message.y);
            Log.DebugFormat("z:  {0}", message.z);
            Log.DebugFormat("Face:  {0}", message.face);

            switch (message.actionId)
            {
                case 5: // Shoot arrow
                {
                    if (_itemUseTimer == null) return;

                    Item itemInHand = Inventory.ItemInHand;

                    if (itemInHand == null) return; // Cheat(?)

                    _itemUseTimer.Stop();
                    itemInHand.Release(Level, this, new BlockCoordinates(message.x, message.y, message.z), _itemUseTimer.ElapsedMilliseconds);

                    _itemUseTimer = null;

                    MetadataDictionary metadata = new MetadataDictionary();
                    metadata[0] = new MetadataByte(0);
                    Level.RelayBroadcast(this, new McpeSetEntityData
                    {
                        entityId = EntityId,
                        metadata = metadata,
                    });

                    break;
                }
                case 7: // Respawn
                    ThreadPool.QueueUserWorkItem(delegate(object state) { HandleRespawn(null); });
                    break;
                default:
                    return;
            }
        }
Ejemplo n.º 10
0
        public override MetadataDictionary GetMetadata()
        {
            MetadataDictionary metadata = new MetadataDictionary();
            metadata[0] = new MetadataByte((byte) (HealthManager.IsOnFire ? 1 : 0));
            metadata[1] = new MetadataShort(HealthManager.Air);
            metadata[2] = new MetadataString(NameTag ?? Username);
            metadata[3] = new MetadataByte(1);
            metadata[4] = new MetadataByte(0);
            metadata[7] = new MetadataInt(0);
            metadata[8] = new MetadataByte(0);
            metadata[15] = new MetadataByte(0);
            metadata[16] = new MetadataByte(0);
            metadata[17] = new MetadataLong(0);

            return metadata;
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Handles the player action.
        /// </summary>
        /// <param name="message">The message.</param>
        private void HandlePlayerAction(McpePlayerAction message)
        {
            Log.DebugFormat("Player action: {0}", message.actionId);
            Log.DebugFormat("Entity ID: {0}", message.entityId);
            Log.DebugFormat("Action ID:  {0}", message.actionId);
            Log.DebugFormat("x:  {0}", message.x);
            Log.DebugFormat("y:  {0}", message.y);
            Log.DebugFormat("z:  {0}", message.z);
            Log.DebugFormat("face:  {0}", message.face);

            if (message.entityId != EntityId) return;

            switch (message.actionId)
            {
                case 5: // Shoot arrow
                {
                    if (_itemUseTimer == null) return;

                    MetadataSlot itemSlot = Inventory.ItemInHand;
                    Item itemInHand = ItemFactory.GetItem(itemSlot.Value.Id);

                    if (itemInHand == null) return; // Cheat(?)

                    _itemUseTimer.Stop();
                    itemInHand.Release(Level, this, new BlockCoordinates(message.x, message.y, message.z), _itemUseTimer.ElapsedMilliseconds);

                    _itemUseTimer = null;

                    MetadataDictionary metadata = new MetadataDictionary();
                    metadata[0] = new MetadataByte(0);
                    Level.RelayBroadcast(this, new McpeSetEntityData
                    {
                        entityId = EntityId,
                        metadata = metadata,
                    });

                    break;
                }
                case 7: // Respawn
                    HandleRespawn(null);
                    break;
                default:
                    return;
            }
        }
Ejemplo n.º 12
0
 public override MetadataDictionary GetMetadata()
 {
     var md = base.GetMetadata();
     md[MetadataSize] = new MetadataByte(Size);
     return md;
 }
Ejemplo n.º 13
0
        public override MetadataDictionary GetMetadata()
        {
            var metadata = base.GetMetadata();

            if (IsCritical)
            {
                metadata[16] = new MetadataByte(1);
            }

            if (Shooter != null)
            {
                metadata[17] = new MetadataLong(Shooter.EntityId);
            }

            return metadata;
        }
Ejemplo n.º 14
0
        public override MetadataDictionary GetMetadata()
        {
            //[0] byte 0 0,
            //[1] short 1 300,
            //[2] string 4 Client12,
            //[3] byte 0 1,
            //[4] byte 0 0,
            //[7] int 2 0,
            //[8] byte 0 0,
            //[15] byte 0 0,
            //[16] byte 0 0,
            //[17] long 6 0

            MetadataDictionary metadata = new MetadataDictionary();
            metadata[0] = new MetadataByte((byte) (HealthManager.IsOnFire ? 1 : 0));
            metadata[1] = new MetadataShort(HealthManager.Air);
            metadata[2] = new MetadataString(Username);
            metadata[3] = new MetadataByte(1);
            metadata[4] = new MetadataByte(0);
            metadata[7] = new MetadataInt(0);
            metadata[8] = new MetadataByte(0);
            metadata[15] = new MetadataByte(0);
            metadata[16] = new MetadataByte(0);
            metadata[17] = new MetadataLong(0);

            return metadata;
        }