Exemplo n.º 1
0
        public static ItemStack FromReader(IMinecraftDataReader reader)
        {
            var itemStack = new ItemStack(reader.ReadShort()); // -- ID

            if (itemStack.ID == -1 || itemStack.Count == -1)
            {
                return(EmptyStack);
            }


            itemStack.Count  = reader.ReadSByte();
            itemStack.Damage = reader.ReadShort();

            var length = reader.ReadVarInt();

            if (length == -1 || length == 0)
            {
                return(itemStack);
            }

            itemStack.NBTData = reader.ReadByteArray(length);
            // TODO: NBTTag reading

            return(itemStack);
        }
Exemplo n.º 2
0
        public static ItemStackList FromReader(IMinecraftDataReader reader)
        {
            var value = new ItemStackList();

            var count = reader.ReadShort();

            for (int i = 0; i < count; i++)
            {
                var slot = new ItemStack(reader.ReadShort()); // -- ID

                if (slot.ID == -1 || slot.Count == -1)
                {
                    value[i] = ItemStack.EmptyStack;
                    break;
                }

                slot.Count  = reader.ReadSByte();
                slot.Damage = reader.ReadShort();

                var length = reader.ReadVarInt();
                if (length == -1)
                {
                    value[i] = slot;
                    break;
                }

                slot.NBTData = reader.ReadByteArray(length);
            }

            return(value);
        }
Exemplo n.º 3
0
 public static Coordinates2D FromReaderShort(IMinecraftDataReader reader)
 {
     return(new Coordinates2D
            (
                reader.ReadShort(),
                reader.ReadShort()
            ));
 }
Exemplo n.º 4
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId   = reader.ReadByte();
            PropertyId = reader.ReadShort();
            Value      = reader.ReadShort();

            return(this);
        }
Exemplo n.º 5
0
 public static Vector3 FromReaderShort(IMinecraftDataReader reader)
 {
     return(new Vector3(
                reader.ReadShort(),
                reader.ReadShort(),
                reader.ReadShort()
                ));
 }
Exemplo n.º 6
0
 public static Position FromReaderShort(IMinecraftDataReader reader)
 {
     return(new Position
            (
                reader.ReadShort(),
                reader.ReadShort(),
                reader.ReadShort()
            ));
 }
Exemplo n.º 7
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Variable = (EnvironmentalVariable)reader.ReadByte();
            Red      = reader.ReadShort();
            Green    = reader.ReadShort();
            Blue     = reader.ReadShort();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            VelocityX = reader.ReadShort();
            VelocityY = reader.ReadShort();
            VelocityZ = reader.ReadShort();

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Variable = (EnvironmentalVariable) reader.ReadByte();
            Red = reader.ReadShort();
            Green = reader.ReadShort();
            Blue = reader.ReadShort();

            return this;
        }
Exemplo n.º 10
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID  = reader.ReadVarInt();
            VelocityX = reader.ReadShort();
            VelocityY = reader.ReadShort();
            VelocityZ = reader.ReadShort();

            return(this);
        }
Exemplo n.º 11
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID     = reader.ReadByte();
            Slot         = reader.ReadShort();
            Button       = reader.ReadByte();
            ActionNumber = reader.ReadShort();
            Mode         = reader.ReadByte();
            ClickedItem  = ItemStack.FromReader(reader);

            return(this);
        }
Exemplo n.º 12
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID = reader.ReadByte();
            Slot = reader.ReadShort();
            Button = reader.ReadByte();
            ActionNumber = reader.ReadShort();
            Mode = reader.ReadByte();
            ClickedItem = ItemStack.FromReader(reader);

            return this;
        }
Exemplo n.º 13
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            SelectionID   = reader.ReadByte();
            Label         = reader.ReadString();
            StartLocation = Position.FromReaderShort(reader);
            EndLocation   = Position.FromReaderShort(reader);
            Red           = reader.ReadShort();
            Green         = reader.ReadShort();
            Blue          = reader.ReadShort();
            Opacity       = reader.ReadShort();

            return(this);
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            SelectionID = reader.ReadByte();
            Label = reader.ReadString();
            StartLocation = Position.FromReaderShort(reader);
            EndLocation = Position.FromReaderShort(reader);
            Red = reader.ReadShort();
            Green = reader.ReadShort();
            Blue = reader.ReadShort();
            Opacity = reader.ReadShort();

            return this;
        }
Exemplo n.º 15
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type = (Mobs) reader.ReadByte();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            HeadPitch = reader.ReadSByte();
            VelocityX = reader.ReadShort();
            VelocityY = reader.ReadShort();
            VelocityZ = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return this;
        }
Exemplo n.º 16
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID       = reader.ReadVarInt();
            Type           = (Mobs)reader.ReadByte();
            Vector3        = Vector3.FromReaderIntFixedPoint(reader);
            Yaw            = reader.ReadSByte();
            Pitch          = reader.ReadSByte();
            HeadPitch      = reader.ReadSByte();
            VelocityX      = reader.ReadShort();
            VelocityY      = reader.ReadShort();
            VelocityZ      = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return(this);
        }
Exemplo n.º 17
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            AppName = reader.ReadString();
            ExtensionCount = reader.ReadShort();

            return this;
        }
Exemplo n.º 18
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            AppName        = reader.ReadString();
            ExtensionCount = reader.ReadShort();

            return(this);
        }
Exemplo n.º 19
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Slot        = reader.ReadShort();
            ClickedItem = ItemStack.FromReader(reader);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3  = Vector3.FromReaderIntFixedPoint(reader);
            Count    = reader.ReadShort();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Slot     = (EntityEquipmentSlot)reader.ReadShort();
            Item     = ItemStack.FromReader(reader);

            return(this);
        }
Exemplo n.º 22
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            ChunkLength = reader.ReadShort();
            ChunkData = reader.ReadByteArray(1024);
            PercentComplete = reader.ReadByte();

            return this;
        }
Exemplo n.º 23
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type = (Objects) reader.ReadByte();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadByte();
            Pitch = reader.ReadByte();
            var data = reader.ReadInt();
            if (data > 0)
            {
                SpeedX = reader.ReadShort();
                SpeedY = reader.ReadShort();
                SpeedZ = reader.ReadShort();
            }

            return this;
        }
Exemplo n.º 24
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            ChunkLength     = reader.ReadShort();
            ChunkData       = reader.ReadByteArray(1024);
            PercentComplete = reader.ReadByte();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Count = reader.ReadShort();

            return this;
        }
Exemplo n.º 26
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId = reader.ReadSByte();
            Slot     = reader.ReadShort();
            SlotData = ItemStack.FromReader(reader);

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowID = reader.ReadByte();
            Slot = reader.ReadShort();
            Accepted = reader.ReadBoolean();

            return this;
        }
Exemplo n.º 28
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId     = reader.ReadByte();
            ActionNumber = reader.ReadShort();
            Accepted     = reader.ReadBoolean();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Slot = (EntityEquipmentSlot) reader.ReadShort();
            Item = ItemStack.FromReader(reader);

            return this;
        }
Exemplo n.º 30
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            WindowId = reader.ReadSByte();
            Slot = reader.ReadShort();
            SlotData = ItemStack.FromReader(reader);

            return this;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            TextureURL = reader.ReadString();
            SideBlock = reader.ReadByte();
            EdgeBlock = reader.ReadByte();
            SideLevel = reader.ReadShort();

            return this;
        }
Exemplo n.º 32
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            Type     = (Objects)reader.ReadByte();
            Vector3  = Vector3.FromReaderIntFixedPoint(reader);
            Yaw      = reader.ReadByte();
            Pitch    = reader.ReadByte();
            var data = reader.ReadInt();

            if (data > 0)
            {
                SpeedX = reader.ReadShort();
                SpeedY = reader.ReadShort();
                SpeedZ = reader.ReadShort();
            }

            return(this);
        }
Exemplo n.º 33
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ProtocolVersion = reader.ReadVarInt();
            ServerAddress   = reader.ReadString();
            ServerPort      = reader.ReadShort();
            NextState       = (NextState)reader.ReadVarInt();

            return(this);
        }
Exemplo n.º 34
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            TextureURL = reader.ReadString();
            SideBlock  = reader.ReadByte();
            EdgeBlock  = reader.ReadByte();
            SideLevel  = reader.ReadShort();

            return(this);
        }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Channel = reader.ReadString();
            int length = reader.ReadShort();

            Data = reader.ReadByteArray(length);

            return(this);
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            NameID     = reader.ReadShort();
            PlayerName = reader.ReadString();
            ListName   = reader.ReadString();
            GroupName  = reader.ReadString();
            GroupRank  = reader.ReadByte();

            return(this);
        }
Exemplo n.º 37
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Flying = (Flying) reader.ReadByte();
            NoClip = (NoClip) reader.ReadByte();
            Speeding = (Speeding) reader.ReadByte();
            SpawnControl = (SpawnControl) reader.ReadByte();
            ThirdPersonView = (ThirdPersonView) reader.ReadByte();
            JumpHeight = reader.ReadShort();

            return this;
        }
Exemplo n.º 38
0
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Flying          = (Flying)reader.ReadByte();
            NoClip          = (NoClip)reader.ReadByte();
            Speeding        = (Speeding)reader.ReadByte();
            SpawnControl    = (SpawnControl)reader.ReadByte();
            ThirdPersonView = (ThirdPersonView)reader.ReadByte();
            JumpHeight      = reader.ReadShort();

            return(this);
        }
Exemplo n.º 39
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID       = reader.ReadVarInt();
            PlayerUUID     = reader.ReadBigInteger();
            Vector3        = Vector3.FromReaderIntFixedPoint(reader);
            Yaw            = reader.ReadSByte();
            Pitch          = reader.ReadSByte();
            CurrentItem    = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return(this);
        }
Exemplo n.º 40
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            EntityID = reader.ReadVarInt();
            PlayerUUID = reader.ReadBigInteger();
            Vector3 = Vector3.FromReaderIntFixedPoint(reader);
            Yaw = reader.ReadSByte();
            Pitch = reader.ReadSByte();
            CurrentItem = reader.ReadShort();
            EntityMetadata = EntityMetadataList.FromReader(reader);

            return this;
        }
Exemplo n.º 41
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ItemDamage = reader.ReadVarInt();
            Scale = reader.ReadSByte();
            IconList = IconList.FromReader(reader);
            Columns = reader.ReadSByte();

            if (Columns > 0)
            {
                Rows = reader.ReadSByte();
                X = reader.ReadSByte();
                Y = reader.ReadSByte();
                var dataLength = reader.ReadShort();
                Data = reader.ReadByteArray(dataLength);
            }

            return this;
        }
Exemplo n.º 42
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            ItemDamage = reader.ReadVarInt();
            Scale      = reader.ReadSByte();
            IconList   = IconList.FromReader(reader);
            Columns    = reader.ReadSByte();

            if (Columns > 0)
            {
                Rows = reader.ReadSByte();
                X    = reader.ReadSByte();
                Y    = reader.ReadSByte();
                var dataLength = reader.ReadShort();
                Data = reader.ReadByteArray(dataLength);
            }

            return(this);
        }
Exemplo n.º 43
0
        public static RecordList FromReader(IMinecraftDataReader reader)
        {
            var value = new RecordList();

            var count = reader.ReadVarInt();

            for (int i = 0; i < count; i++)
            {
                var record = new Record();

                var coordinates = reader.ReadShort();
                var y           = coordinates & 0xFF;
                var z           = (coordinates >> 8) & 0xf;
                var x           = (coordinates >> 12) & 0xf;

                record.BlockIDMeta = reader.ReadVarInt();
                record.Coordinates = new Position(x, y, z);

                value[i] = record;
            }

            return(value);
        }
Exemplo n.º 44
0
        public static RecordList FromReader(IMinecraftDataReader reader)
        {
            var value = new RecordList();

            var count = reader.ReadVarInt();

            for (int i = 0; i < count; i++)
            {
                var record = new Record();

                var coordinates = reader.ReadShort();
                var y = coordinates & 0xFF;
                var z = (coordinates >> 8) & 0xf; 
                var x = (coordinates >> 12) & 0xf;

                record.BlockIDMeta = reader.ReadVarInt();
                record.Coordinates = new Position(x, y, z);

                value[i] = record;
            }

            return value;
        }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Distance = reader.ReadShort();

            return(this);
        }
Exemplo n.º 46
0
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Slot = reader.ReadShort();

            return(this);
        }
 public override void FromReader(IMinecraftDataReader reader)
 {
     Value = reader.ReadShort();
 }
        public IPacketWithSize ReadPacket(IMinecraftDataReader reader)
        {
            Distance = reader.ReadShort();

            return this;
        }
Exemplo n.º 49
0
 public override void FromReader(IMinecraftDataReader reader)
 {
     Value = reader.ReadShort();
 }
        public IPacket ReadPacket(IMinecraftDataReader reader)
        {
            Slot = reader.ReadShort();

            return this;
        }