ReadInt16() public method

Reads a 16-bit signed integer from the stream, using the bit converter for this reader. 2 bytes are read.
public ReadInt16 ( ) : short
return short
Example #1
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Velocity = new CoordDouble();
     Velocity.X = ((double)r.ReadInt16()) / scale;
     Velocity.Y = ((double)r.ReadInt16()) / scale;
     Velocity.Z = ((double)r.ReadInt16()) / scale;
 }
Example #2
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     Slot = r.ReadInt16();
     RightClick = r.ReadSByte();
     ActionID = r.ReadInt16();
     Shift = r.ReadSByte();
     Item = SlotItem.Read(r);
 }
Example #3
0
            public UItem(EndianBinaryReader r)
            {
                X = r.ReadInt32();
                Z = r.ReadInt32();
                OccupiedBitmap = r.ReadInt16();
                AdditionalBitmap = r.ReadInt16();
#if DEBUG
                if (AdditionalBitmap != 0)
                    Log.WriteServer("AdditionalData: " + AdditionalBitmap.ToString("X"));
#endif
            }
Example #4
0
        protected override void Parse(EndianBinaryReader r)
        {
            SlotID = r.ReadInt16();

            if (SlotID < 0 && SlotID > 8)
                throw new InvalidOperationException("Invalid holding slot id: " + SlotID);
        }
Example #5
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Type = (MobType)r.ReadByte();
     Pos = ReadAbsInt(r);
     Yaw = r.ReadSByte() * Math.PI / 128;
     Pitch = r.ReadSByte() * Math.PI / 128;
     HeadYaw = r.ReadByte();
     UX = r.ReadInt16();
     UY = r.ReadInt16();
     UZ = r.ReadInt16();
     Metadata = Metadata.Read(r);
     #if DEBUGPACKET
     if (Type.ToString() == ((int)Type).ToString())
         throw new NotImplementedException(Type.ToString());
     #endif
 }
Example #6
0
 protected override void Parse(EndianBinaryReader r)
 {
     int columnCount = r.ReadInt16();
     int compressedLength = r.ReadInt32();
     Unknown = r.ReadBoolean();
     CompressedChunkColumns = r.ReadBytesOrThrow(compressedLength);
     ColumnMeta = new UItem[columnCount];
     for (int n = 0; n < columnCount; n++)
     {
         ColumnMeta [n] = new UItem(r);
     }
 }
Example #7
0
        protected override void Parse(EndianBinaryReader r)
        {
            WindowID = r.ReadByte();
            int count = r.ReadInt16();
            Items = new SlotItem [count];
            for (int n = 0; n < Items.Length; n++)
            {
                Items [n] = SlotItem.Read(r);
#if DEBUG
                //Console.WriteLine("Slot " + n + ": " + Items [n]);
#endif
            }
        }
Example #8
0
        protected override void Parse(EndianBinaryReader r)
        {
            EID = ReadVarInt(r);
            Type = (Vehicles)r.ReadByte();
            #if DEBUGPACKET
            if (Type.ToString() == ((int)Type).ToString())
                throw new NotImplementedException(Type.ToString());
            #endif
            if (Type == Vehicles.Unknown)
                Console.WriteLine();
            Position = ReadAbsInt(r);

            Yaw = r.ReadSByte();
            Pitch = r.ReadSByte();

            SourceEntity = r.ReadInt32();
            if (SourceEntity <= 0)
                return;
            short vx = r.ReadInt16();
            short vy = r.ReadInt16();
            short vz = r.ReadInt16();			
            Velocity = new CoordInt(vx, vy, vz);
        }
Example #9
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     PlayerUUID = new Guid(r.ReadBytesOrThrow(16));
     Position = ReadAbsInt(r);
     Yaw = r.ReadSByte() * Math.PI / 128;
     Pitch = r.ReadSByte() * Math.PI / 128;
     CurrentItem = r.ReadInt16();
     try
     {
         Meta = Metadata.Read(r);
     }
     catch (Exception)
     {
         Console.WriteLine("BadMeta: " + BitConverter.ToString(PacketBuffer));
     }
     Debug.WriteLine("Parsed " + this);
 }
Example #10
0
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Slot = r.ReadInt16();
     Item = SlotItem.Read(r);
 }
 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Position = ReadAbsInt(r);
     Count = r.ReadInt16();
 }
Example #12
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     Property = r.ReadInt16();
     Value = r.ReadInt16();
 }
Example #13
0
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     Slot = r.ReadInt16();
     Item = SlotItem.Read(r);
 }
 protected override void Parse(EndianBinaryReader r)
 {
     WindowID = r.ReadByte();
     ActionID = r.ReadInt16();
     Accepted = r.ReadBoolean();
 }