Example #1
0
        public static ItemStack FromStream(MinecraftStream stream)
        {
            var slot = ItemStack.EmptyStack;

            slot.Id = stream.ReadInt16();
            if (slot.Empty)
            {
                return(slot);
            }
            slot.Count    = stream.ReadInt8();
            slot.Metadata = stream.ReadInt16();
            var length = stream.ReadInt16();

            if (length == -1)
            {
                return(slot);
            }
            slot.Nbt = new NbtCompound();
            var buffer = stream.ReadUInt8Array(length);
            var nbt    = new NbtFile();

            nbt.LoadFromBuffer(buffer, 0, length, NbtCompression.GZip, null);
            slot.Nbt = nbt.RootTag;
            return(slot);
        }
Example #2
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     var ssLength = stream.ReadInt16();
     SharedSecret = stream.ReadUInt8Array(ssLength);
     var vtLength = stream.ReadInt16();
     VerificationToken = stream.ReadUInt8Array(vtLength);
     return mode;
 }
Example #3
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Action = stream.ReadUInt8();
     var length = stream.ReadInt16();
     var data = stream.ReadUInt8Array(length);
     Nbt = new NbtFile();
     Nbt.LoadFromBuffer(data, 0, length, NbtCompression.GZip, null);
     return mode;
 }
Example #4
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadSingle();
     Y = stream.ReadSingle();
     Z = stream.ReadSingle();
     Radius = stream.ReadSingle();
     RecordCount = stream.ReadInt32();
     Records = stream.ReadUInt8Array(RecordCount * 3);
     PlayerVelocityX = stream.ReadSingle();
     PlayerVelocityY = stream.ReadSingle();
     PlayerVelocityZ = stream.ReadSingle();
     return mode;
 }
Example #5
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     ServerId = stream.ReadString();
     var pkLength = stream.ReadInt16();
     PublicKey = stream.ReadUInt8Array(pkLength);
     var vtLength = stream.ReadInt16();
     VerificationToken = stream.ReadUInt8Array(vtLength);
     return mode;
 }
Example #6
0
        public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
        {
            ChunkCount = stream.ReadInt16();
            var length = stream.ReadInt32();
            LightIncluded = stream.ReadBoolean();
            ChunkData = stream.ReadUInt8Array(length);

            ChunkMetadata = new Metadata[ChunkCount];
            for (int i = 0; i < ChunkCount; i++)
            {
                var metadata = new Metadata();
                metadata.ChunkX = stream.ReadInt32();
                metadata.ChunkZ = stream.ReadInt32();
                metadata.PrimaryBitMap = stream.ReadUInt16();
                metadata.AddBitMap = stream.ReadUInt16();
                ChunkMetadata[i] = metadata;
            }
            return mode;
        }
Example #7
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Z = stream.ReadInt32();
     GroundUpContinuous = stream.ReadBoolean();
     PrimaryBitMap = stream.ReadUInt16();
     var length = stream.ReadVarInt();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Example #8
0
        public void ReadPacket(MinecraftStream stream)
        {
            ChunkCount = stream.ReadInt16();
            var length = stream.ReadInt32();
            LightIncluded = stream.ReadBoolean();
            ChunkData = stream.ReadUInt8Array(length);

            ChunkMetadata = new Metadata[ChunkCount];
            for (int i = 0; i < ChunkCount; i++)
            {
                var metadata = new Metadata();
                metadata.ChunkX = stream.ReadInt32();
                metadata.ChunkZ = stream.ReadInt32();
                metadata.PrimaryBitMap = stream.ReadUInt16();
                metadata.AddBitMap = stream.ReadUInt16();
                ChunkMetadata[i] = metadata;
            }
        }
Example #9
0
 public void ReadPacket(MinecraftStream stream)
 {
     ServerId = stream.ReadString();
     var pkLength = stream.ReadInt16();
     PublicKey = stream.ReadUInt8Array(pkLength);
     var vtLength = stream.ReadInt16();
     VerificationToken = stream.ReadUInt8Array(vtLength);
 }
Example #10
0
 public void ReadPacket(MinecraftStream stream)
 {
     Channel = stream.ReadString();
     var length = stream.ReadInt16();
     Data = stream.ReadUInt8Array(length);
 }
Example #11
0
 public void ReadPacket(MinecraftStream stream)
 {
     var ssLength = stream.ReadInt16();
     SharedSecret = stream.ReadUInt8Array(ssLength);
     var vtLength = stream.ReadInt16();
     VerificationToken = stream.ReadUInt8Array(vtLength);
 }
Example #12
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Action = stream.ReadUInt8();
     var length = stream.ReadInt16();
     var data = stream.ReadUInt8Array(length);
     Nbt = new NbtFile();
     Nbt.LoadFromBuffer(data, 0, length, NbtCompression.GZip, null);
 }
Example #13
0
 public void ReadPacket(MinecraftStream stream)
 {
     ItemType = stream.ReadInt16();
     ItemId = stream.ReadInt16();
     var length = stream.ReadInt16();
     Text = Encoding.ASCII.GetString(stream.ReadUInt8Array(length));
 }
Example #14
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadDouble();
     Y = stream.ReadDouble();
     Z = stream.ReadDouble();
     Radius = stream.ReadSingle();
     RecordCount = stream.ReadInt32();
     Records = stream.ReadUInt8Array(RecordCount * 3);
     PlayerVelocityX = stream.ReadSingle();
     PlayerVelocityY = stream.ReadSingle();
     PlayerVelocityZ = stream.ReadSingle();
 }
Example #15
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Channel = stream.ReadString();
     var length = stream.ReadInt16();
     Data = stream.ReadUInt8Array(length);
     return mode;
 }
Example #16
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     var count = stream.ReadInt32();
     if (count < 0)
         throw new InvalidOperationException("Cannot specify less than zero properties.");
     Properties = new EntityProperty[count];
     for (int i = 0; i < count; i++)
     {
         var property = new EntityProperty();
         property.Key = stream.ReadString();
         property.Value = stream.ReadDouble();
         var listLength = stream.ReadVarInt();
         property.Modifiers = new EntityPropertyListItem[listLength];
         for (int j = 0; j < listLength; j++)
         {
             var item = new EntityPropertyListItem();
             item.PropertUUID = new Guid(stream.ReadUInt8Array(16));
             item.Amount = stream.ReadDouble();
             item.Operation = stream.ReadUInt8();
             property.Modifiers[j] = item;
         }
         Properties[i] = property;
     }
     return mode;
 }
Example #17
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     PlayerUuid = new Guid(stream.ReadUInt8Array(16)); 
     PlayerName = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeldItem = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
     return mode;
 }
Example #18
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Z = stream.ReadInt32();
     GroundUpContinuous = stream.ReadBoolean();
     PrimaryBitMap = stream.ReadUInt16();
     AddBitMap = stream.ReadUInt16();
     var length = stream.ReadInt32();
     Data = stream.ReadUInt8Array(length);
 }