public static object[] ReadEntityMetadata(Wrapped wSock) {
            var MetadataDict = new Dictionary<int, object>();

            do {
                var item = wSock.readByte();

                if (item == 127)
                    break;

                var index = item & 0x1F;
                var type = item >> 5;

                switch (type) {
                    case 0:
                        MetadataDict.Add(index, wSock.readByte());
                        break;
                    case 1:
                        MetadataDict.Add(index, wSock.readShort());
                        break;
                    case 2:
                        MetadataDict.Add(index, wSock.readInt());
                        break;
                    case 3:
                        MetadataDict.Add(index, wSock.readFloat());
                        break;
                    case 4:
                        MetadataDict.Add(index, wSock.readString());
                        break;
                    case 5:
                        MetadataDict.Add(index, ReadSlot(wSock));
                        break;
                    case 6:
                        MetadataDict.Add(index, new Vector(wSock.readInt(), wSock.readInt(), wSock.readInt()));
                        break;
                }
            } while (true);

            MetadataDict.OrderBy(o => o.Key); // -- Order the dictionary based on the index values
            return MetadataDict.Values.ToArray(); // -- Return the data as an array.
        }
Beispiel #2
0
        public void Read(Wrapped wSock) {
            ChunkX = wSock.readInt();
            ChunkZ = wSock.readInt();
            Recordcount = wSock.readShort();
            Datasize = wSock.readInt();
            Records = new Record[Recordcount];

            for (int x = 0; x < Recordcount; x++)
                Records[x] = WrappedExtension.ReadRecord(wSock);
        }
Beispiel #3
0
 public void Read(Wrapped wSock) {
     CollectedEntityID = wSock.readInt();
     CollectorEntityID = wSock.readInt();
 }
Beispiel #4
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readInt();
     Z = wSock.readInt();
 }
Beispiel #5
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readInt();
     X = wSock.readInt();
     Y = wSock.readByte();
     Z = wSock.readInt();
 }
Beispiel #6
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readShort();
     Z = wSock.readInt();
     Line1 = wSock.readString();
     Line2 = wSock.readString();
     Line3 = wSock.readString();
     Line4 = wSock.readString();
 }
Beispiel #7
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readInt();
     Gamemode = wSock.readByte();
     Dimension = wSock.readSByte();
     Difficulty = wSock.readByte();
     MaxPlayers = wSock.readByte();
     LevelType = wSock.readString();
 }
Beispiel #8
0
 public void Read(Wrapped wSock) {
     SoundName = wSock.readString();
     EffectpositionX = wSock.readInt();
     EffectpositionY = wSock.readInt();
     EffectpositionZ = wSock.readInt();
     Volume = wSock.readFloat();
     Pitch = wSock.readByte();
 }
Beispiel #9
0
 public void Read(Wrapped wSock) {
     Particlename = wSock.readString();
     X = wSock.readFloat();
     Y = wSock.readFloat();
     Z = wSock.readFloat();
     OffsetX = wSock.readFloat();
     OffsetY = wSock.readFloat();
     OffsetZ = wSock.readFloat();
     Particledata = wSock.readFloat();
     Numberofparticles = wSock.readInt();
 }
Beispiel #10
0
        public void Read(Wrapped wSock) {
            X = wSock.readFloat();
            Y = wSock.readFloat();
            Z = wSock.readFloat();
            Radius = wSock.readFloat();
            Recordcount = wSock.readInt();
            Records = new sbyte[Recordcount * 3];

            for (int x = 0; x < Records.Length - 1; x++) {
                Records[x] = wSock.readSByte();
            }

            PlayerMotionX = wSock.readFloat();
            PlayerMotionY = wSock.readFloat();
            PlayerMotionZ = wSock.readFloat();
        }
Beispiel #11
0
 public void Read(Wrapped wSock) {
     EffectID = wSock.readInt();
     X = wSock.readInt();
     Y = wSock.readSByte();
     Z = wSock.readInt();
     Data = wSock.readInt();
     Disablerelativevolume = wSock.readBool();
 }
Beispiel #12
0
 public void Read(Wrapped wSock) {
     Chunkcolumncount = wSock.readShort();
     Datalength = wSock.readInt();
     Skylightsent = wSock.readBool();
     Data = wSock.readByteArray(Datalength);
     Metainformation = wSock.readByteArray(Chunkcolumncount * 12);
 }
Beispiel #13
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readShort();
     Z = wSock.readInt();
     Byte1 = wSock.readByte();
     Byte2 = wSock.readByte();
     BlockType = wSock.readVarInt();
 }
Beispiel #14
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readByte();
     Z = wSock.readInt();
     BlockID = wSock.readVarInt();
     BlockMetadata = wSock.readByte();
 }
Beispiel #15
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readInt();
     Animation = wSock.readSByte();
 }
Beispiel #16
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readVarInt();
     Type = wSock.readSByte();
     X = wSock.readInt();
     Y = wSock.readInt();
     Z = wSock.readInt();
 }
Beispiel #17
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readInt();
     ActionID = wSock.readSByte();
     JumpBoost = wSock.readInt();
 }
Beispiel #18
0
 public void Read(Wrapped wSock) {
     Windowid = wSock.readByte();
     InventoryType = wSock.readByte();
     Windowtitle = wSock.readString();
     NumberofSlots = wSock.readByte();
     Useprovidedwindowtitle = wSock.readBool();
     EntityID = wSock.readInt();
 }
Beispiel #19
0
 public void Read(Wrapped wSock) {
     KeepAliveID = wSock.readInt();
 }
Beispiel #20
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readShort();
     Z = wSock.readInt();
     Action = wSock.readByte();
     Datalength = wSock.readShort();
     NBTData = wSock.readByteArray(Datalength);
 }
Beispiel #21
0
 public void Read(Wrapped wSock) {
     EntityID = wSock.readInt();
     Slot = wSock.readShort();
     Item = WrappedExtension.ReadSlot(wSock);
 }
Beispiel #22
0
 public void Read(Wrapped wSock) {
     ItemName = wSock.readString();
     Update = wSock.readSByte();
     ScoreName = wSock.readString();
     Value = wSock.readInt();
 }
Beispiel #23
0
 public void Read(Wrapped wSock) {
     Dimension = wSock.readInt(); // -- Only possible values for this are -1, 0, and 1.. No reason for it to be an int and waste 4 bytes. Thanks mojang.
     Difficulty = wSock.readByte();
     Gamemode = wSock.readByte();
     LevelType = wSock.readString();
 }
Beispiel #24
0
 public void Read(Wrapped wSock) {
     Target = wSock.readInt();
     Mouse = wSock.readSByte();
 }
Beispiel #25
0
        public void Read(Wrapped wSock) {
            EntityID = wSock.readVarInt();
            PlayerUUID = wSock.readString();
            PlayerName = wSock.readString();
            Datacount = wSock.readVarInt();
            Data = new PlayerData[Datacount];

            for (int i = 0; i < Datacount; i++) {
                Data[i].Name = wSock.readString();
                Data[i].Value = wSock.readString();
                Data[i].Signature = wSock.readString();
            }

            X = wSock.readInt();
            Y = wSock.readInt();
            Z = wSock.readInt();
            Yaw = wSock.readSByte();
            Pitch = wSock.readSByte();
            CurrentItem = wSock.readShort();
            Metadata = WrappedExtension.ReadEntityMetadata(wSock);
        }
Beispiel #26
0
 public void Read(Wrapped wSock) {
     Status = wSock.readSByte();
     X = wSock.readInt();
     Y = wSock.readByte();
     Z = wSock.readInt();
     Face = wSock.readSByte();
 }
        public static Record ReadRecord(Wrapped wSock) {
            var Data = new Record();
            var RecordData = wSock.readInt();

            Data.Metadata = (byte)(RecordData & 0xF);
            Data.BlockID = (short)((RecordData >> 4) & 0xFFF);
            Data.Y = (byte)((RecordData >> 16) & 0xFF);
            Data.Z = (byte)((RecordData >> 24) & 0xF);
            Data.X = (byte)((RecordData >> 28) & 0xF);

            return Data;
        }
Beispiel #28
0
 public void Read(Wrapped wSock) {
     X = wSock.readInt();
     Y = wSock.readByte();
     Z = wSock.readInt();
     Direction = wSock.readSByte();
     Helditem = WrappedExtension.ReadSlot(wSock);
     CursorpositionX = wSock.readSByte();
     CursorpositionY = wSock.readSByte();
     CursorpositionZ = wSock.readSByte();
     Slot = wSock.readShort();
 }
        public static ObjectMetadata ReadObjectMetadata(Wrapped wSock) {
            var Data = new ObjectMetadata();
            Data.ObjectID = wSock.readInt();

            if (Data.ObjectID != 0) {
                Data.SpeedX = wSock.readShort();
                Data.SpeedY = wSock.readShort();
                Data.SpeedZ = wSock.readShort();
            }

            return Data;
        }
Beispiel #30
0
 public void Read(Wrapped wSock) {
     ChunkX = wSock.readInt();
     ChunkZ = wSock.readInt();
     GroundUpcontinuous = wSock.readBool();
     Primarybitmap = (ushort)wSock.readShort();
     Addbitmap = (ushort)wSock.readShort();
     Compressedsize = wSock.readInt();
     Compresseddata = wSock.readByteArray(Compressedsize);
 }