コード例 #1
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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();
 }
コード例 #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);
        }
コード例 #3
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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();
     }
 }
コード例 #4
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadUInt8();
 }
コード例 #5
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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();
 }
コード例 #6
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Magic = stream.ReadUInt8();
 }
コード例 #7
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Position = (ScoreboardPosition)stream.ReadUInt8();
     ScoreName = stream.ReadString();
 }
コード例 #8
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Locale = stream.ReadString();
     ViewDistance = stream.ReadUInt8();
     ChatFlags = (ChatMode)(stream.ReadUInt8() & 0x3);
     Difficulty = (Difficulty)stream.ReadUInt8();
     ShowCape = stream.ReadBoolean();
 }
コード例 #9
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     InventoryType = stream.ReadUInt8();
     WindowTitle = stream.ReadString();
     SlotCount = stream.ReadUInt8();
     UseProvidedTitle = stream.ReadBoolean();
 }
コード例 #10
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     State = (GameState)stream.ReadUInt8();
     GameMode = (GameMode)stream.ReadUInt8();
 }
コード例 #11
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     SoundName = stream.ReadString();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     Volume = stream.ReadSingle();
     Pitch = stream.ReadUInt8();
 }
コード例 #12
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Data = stream.ReadInt32();
     DisableRelativeVolume = stream.ReadBoolean();
 }
コード例 #13
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     X = stream.ReadInt32();
     Y = stream.ReadInt32();
     Z = stream.ReadInt32();
     DestroyStage = stream.ReadUInt8();
 }
コード例 #14
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadInt16();
     Z = stream.ReadInt32();
     Data1 = stream.ReadUInt8();
     Data2 = stream.ReadUInt8();
     BlockId = stream.ReadInt16();
 }
コード例 #15
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     BlockType = stream.ReadInt16();
     BlockMetadata = stream.ReadUInt8();
 }
コード例 #16
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Flags = stream.ReadUInt8();
     FlyingSpeed = stream.ReadUInt8();
     WalkingSpeed = stream.ReadUInt8();
 }
コード例 #17
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     SlotIndex = stream.ReadInt16();
     MouseButton = stream.ReadUInt8();
     ActionNumber = stream.ReadInt16();
     Shift = stream.ReadBoolean();
     ClickedItem = ItemStack.FromStream(stream);
 }
コード例 #18
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Status = (ClientStatus)stream.ReadUInt8();
 }
コード例 #19
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     SlotIndex = stream.ReadInt16();
     Item = ItemStack.FromStream(stream);
 }
コード例 #20
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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();
     }
 }
コード例 #21
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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);
 }
コード例 #22
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     Action = (PlayerAction)stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = stream.ReadUInt8();
 }
コード例 #23
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     PropertyId = stream.ReadInt16();
     Value = stream.ReadInt16();
 }
コード例 #24
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Unknown = stream.ReadUInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
 }
コード例 #25
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     ActionNumber = stream.ReadInt16();
     Accepted = stream.ReadBoolean();
 }
コード例 #26
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     Animation = (AnimationType)stream.ReadUInt8();
 }
コード例 #27
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     WindowId = stream.ReadUInt8();
     Enchantment = stream.ReadUInt8();
 }
コード例 #28
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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);
 }
コード例 #29
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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);
 }
コード例 #30
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 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);
 }
コード例 #31
0
ファイル: Packets.cs プロジェクト: skirmish/Craft.Net
 public void ReadPacket(MinecraftStream stream)
 {
     StatisticId = stream.ReadInt32();
     Amount = stream.ReadUInt8();
 }