Esempio n. 1
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     LevelType = stream.ReadString();
     GameMode = (GameMode)stream.ReadUInt8();
     Dimension = (Dimension)stream.ReadInt8();
     Difficulty = (Difficulty)stream.ReadUInt8();
     Discarded = stream.ReadUInt8();
     MaxPlayers = stream.ReadUInt8();
 }
Esempio n. 2
0
        public static IPacket ReadPacket(MinecraftStream stream)
        {
            byte id   = stream.ReadUInt8();
            var  type = Packets[id];

            if (type == null)
            {
                throw new InvalidOperationException("Invalid packet ID: 0x" + id.ToString("X2"));
            }
            var packet = (IPacket)Activator.CreateInstance(type);

            packet.ReadPacket(stream);
            return(packet);
        }
Esempio n. 3
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     Data = stream.ReadInt32();
     if (Data != 0)
     {
         SpeedX = stream.ReadInt16();
         SpeedY = stream.ReadInt16();
         SpeedZ = stream.ReadInt16();
     }
 }
Esempio n. 4
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadUInt8();
 }
Esempio n. 5
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Direction = stream.ReadUInt8();
     HeldItem = ItemStack.FromStream(stream);
     CursorX = stream.ReadUInt8();
     CursorY = stream.ReadUInt8();
     CursorZ = stream.ReadUInt8();
 }
Esempio n. 6
0
 public void ReadPacket(MinecraftStream stream)
 {
     Magic = stream.ReadUInt8();
 }
Esempio n. 7
0
 public void ReadPacket(MinecraftStream stream)
 {
     Position = (ScoreboardPosition)stream.ReadUInt8();
     ScoreName = stream.ReadString();
 }
Esempio n. 8
0
 public void ReadPacket(MinecraftStream stream)
 {
     Locale = stream.ReadString();
     ViewDistance = stream.ReadUInt8();
     ChatFlags = (ChatMode)(stream.ReadUInt8() & 0x3);
     Difficulty = (Difficulty)stream.ReadUInt8();
     ShowCape = stream.ReadBoolean();
 }
Esempio n. 9
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     InventoryType = stream.ReadUInt8();
     WindowTitle = stream.ReadString();
     SlotCount = stream.ReadUInt8();
     UseProvidedTitle = stream.ReadBoolean();
 }
Esempio n. 10
0
 public void ReadPacket(MinecraftStream stream)
 {
     State = (GameState)stream.ReadUInt8();
     GameMode = (GameMode)stream.ReadUInt8();
 }
Esempio n. 11
0
 public void ReadPacket(MinecraftStream stream)
 {
     SoundName = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Volume = stream.ReadSingle();
     Pitch = stream.ReadUInt8();
 }
Esempio n. 12
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Data = stream.ReadInt32();
     DisableRelativeVolume = stream.ReadBoolean();
 }
Esempio n. 13
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     DestroyStage = stream.ReadUInt8();
 }
Esempio n. 14
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Data1 = stream.ReadUInt8();
     Data2 = stream.ReadUInt8();
     BlockId = stream.ReadInt16();
 }
Esempio n. 15
0
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     BlockType = stream.ReadInt16();
     BlockMetadata = stream.ReadUInt8();
 }
Esempio n. 16
0
 public void ReadPacket(MinecraftStream stream)
 {
     Flags = stream.ReadUInt8();
     FlyingSpeed = stream.ReadUInt8();
     WalkingSpeed = stream.ReadUInt8();
 }
Esempio n. 17
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     SlotIndex = stream.ReadInt16();
     MouseButton = stream.ReadUInt8();
     ActionNumber = stream.ReadInt16();
     Shift = stream.ReadBoolean();
     ClickedItem = ItemStack.FromStream(stream);
 }
Esempio n. 18
0
 public void ReadPacket(MinecraftStream stream)
 {
     Status = (ClientStatus)stream.ReadUInt8();
 }
Esempio n. 19
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     SlotIndex = stream.ReadInt16();
     Item = ItemStack.FromStream(stream);
 }
Esempio n. 20
0
 public void ReadPacket(MinecraftStream stream)
 {
     TeamName = stream.ReadString();
     PacketMode = (TeamMode)stream.ReadUInt8();
     if (PacketMode == TeamMode.CreateTeam || PacketMode == TeamMode.UpdateTeam)
     {
         DisplayName = stream.ReadString();
         TeamPrefix = stream.ReadString();
         TeamSuffix = stream.ReadString();
         EnableFriendlyFire = stream.ReadBoolean();
     }
     if (PacketMode == TeamMode.CreateTeam || PacketMode == TeamMode.AddPlayers ||
         PacketMode == TeamMode.RemovePlayers)
     {
         var playerCount = stream.ReadInt16();
         Players = new string[playerCount];
         for (int i = 0; i < playerCount; i++)
             Players[i] = stream.ReadString();
     }
 }
Esempio n. 21
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     short count = stream.ReadInt16();
     Items = new ItemStack[count];
     for (int i = 0; i < count; i++)
         Items[i] = ItemStack.FromStream(stream);
 }
Esempio n. 22
0
 public void ReadPacket(MinecraftStream stream)
 {
     Action = (PlayerAction)stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = stream.ReadUInt8();
 }
Esempio n. 23
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     PropertyId = stream.ReadInt16();
     Value = stream.ReadInt16();
 }
Esempio n. 24
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Unknown = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
 }
Esempio n. 25
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     ActionNumber = stream.ReadInt16();
     Accepted = stream.ReadBoolean();
 }
Esempio n. 26
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Animation = (AnimationType)stream.ReadUInt8();
 }
Esempio n. 27
0
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     Enchantment = stream.ReadUInt8();
 }
Esempio n. 28
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     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);
 }
Esempio n. 29
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);
 }
Esempio n. 30
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Type = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     HeadYaw = stream.ReadUInt8();
     VelocityX = stream.ReadInt16();
     VelocityY = stream.ReadInt16();
     VelocityZ = stream.ReadInt16();
     Metadata = MetadataDictionary.FromStream(stream);
 }
Esempio n. 31
0
 public void ReadPacket(MinecraftStream stream)
 {
     StatisticId = stream.ReadInt32();
     Amount = stream.ReadUInt8();
 }