예제 #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);
        }
예제 #2
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();
 }
예제 #3
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     if (direction == PacketDirection.Clientbound)
         Slot = stream.ReadInt8();
     else
         Slot = stream.ReadInt16();
     return mode;
 }
예제 #4
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     GameMode = (GameMode)stream.ReadUInt8();
     Dimension = (Dimension)stream.ReadInt8();
     Difficulty = (Difficulty)stream.ReadUInt8();
     MaxPlayers = stream.ReadUInt8();
     LevelType = stream.ReadString();
     ReducdedDebug = stream.ReadBoolean();
     return mode;
 }
예제 #5
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     WindowId = stream.ReadInt8();
     EnchantmentIndex = stream.ReadInt8();
     return mode;
 }
예제 #6
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadInt32();
     Action = (EntityAction)stream.ReadInt8();
     JumpBoost = stream.ReadInt32();
     return mode;
 }
예제 #7
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = (BlockFace)stream.ReadUInt8();
     HeldItem = ItemStack.FromStream(stream);
     CursorX = stream.ReadInt8();
     CursorY = stream.ReadInt8();
     CursorZ = stream.ReadInt8();
     return mode;
 }
예제 #8
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Action = (BlockAction)stream.ReadInt8();
     X = stream.ReadInt32();
     Y = stream.ReadUInt8();
     Z = stream.ReadInt32();
     Face = (BlockFace)stream.ReadInt8();
     return mode;
 }
예제 #9
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     WindowId = stream.ReadInt8();
     SlotIndex = stream.ReadInt16();
     MouseButton = stream.ReadUInt8();
     TransactionId = stream.ReadInt16();
     Mode = stream.ReadUInt8();
     ClickedItem = ItemStack.FromStream(stream);
     if (Mode == 0)
     {
         if (MouseButton == 0)
         {
             if (SlotIndex == -999)
                 Action = ClickAction.DropAll;
             else
                 Action = ClickAction.LeftClick;
         }
         else if (MouseButton == 1)
         {
             if (SlotIndex == -999)
                 Action = ClickAction.Drop;
             else
                 Action = ClickAction.RightClick;
         }
         else
             Action = ClickAction.Invalid;
     }
     else if (Mode == 1)
     {
         if (MouseButton == 0)
             Action = ClickAction.ShiftLeftClick;
         else if (MouseButton == 1)
             Action = ClickAction.ShiftRightClick;
         else
             Action = ClickAction.Invalid;
     }
     else if (Mode == 2)
     {
         if (MouseButton == 0)
             Action = ClickAction.NumKey1;
         else if (MouseButton == 1)
             Action = ClickAction.NumKey2;
         else if (MouseButton == 2)
             Action = ClickAction.NumKey3;
         else if (MouseButton == 3)
             Action = ClickAction.NumKey4;
         else if (MouseButton == 4)
             Action = ClickAction.NumKey5;
         else if (MouseButton == 5)
             Action = ClickAction.NumKey6;
         else if (MouseButton == 6)
             Action = ClickAction.NumKey7;
         else if (MouseButton == 7)
             Action = ClickAction.NumKey8;
         else if (MouseButton == 8)
             Action = ClickAction.NumKey9;
         else
             Action = ClickAction.Invalid;
     }
     else if (Mode == 3)
     {
         if (MouseButton == 2)
             Action = ClickAction.MiddleClick;
         else
             Action = ClickAction.Invalid;
     }
     else if (Mode == 4)
     {
         if (SlotIndex == -999)
         {
             if (Mode == 0)
                 Action = ClickAction.LeftClickEdgeWithEmptyHand;
             else if (Mode == 1)
                 Action = ClickAction.RightClickEdgeWithEmptyHand;
             else
                 Action = ClickAction.Invalid;
         }
         else
         {
             if (Mode == 0)
                 Action = ClickAction.Drop;
             else if (Mode == 1)
                 Action = ClickAction.DropAll;
             else
                 Action = ClickAction.Invalid;
         }
     }
     else if (Mode == 5)
     {
         if (MouseButton == 0)
             Action = ClickAction.StartLeftClickPaint;
         else if (MouseButton == 1)
             Action = ClickAction.LeftMousePaintProgress;
         else if (MouseButton == 2)
             Action = ClickAction.EndLeftMousePaint;
         else if (MouseButton == 4)
             Action = ClickAction.StartRightClickPaint;
         else if (MouseButton == 5)
             Action = ClickAction.RightMousePaintProgress;
         else if (MouseButton == 6)
             Action = ClickAction.EndRightMousePaint;
         else
             Action = ClickAction.Invalid;
     }
     else if (Mode == 6)
         Action = ClickAction.DoubleClick;
     else
         Action = ClickAction.Invalid;
     return mode;
 }
예제 #10
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     DeltaX = stream.ReadInt8();
     DeltaY = stream.ReadInt8();
     DeltaZ = stream.ReadInt8();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
     OnGround = stream.ReadBoolean();
     return mode;
 }
예제 #11
0
파일: Packets.cs 프로젝트: umby24/Craft.Net
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     EntityId = stream.ReadVarInt();
     DeltaX = stream.ReadInt8();
     DeltaY = stream.ReadInt8();
     DeltaZ = stream.ReadInt8();
     return mode;
 }
예제 #12
0
 public void ReadPacket(MinecraftStream stream)
 {
     Dimension = (Dimension)stream.ReadInt32();
     Difficulty = (Difficulty)stream.ReadInt8();
     GameMode = (GameMode)stream.ReadInt8();
     WorldHeight = stream.ReadInt16();
     LevelType = stream.ReadString();
 }
예제 #13
0
 public void ReadPacket(MinecraftStream stream)
 {
     EntityId = stream.ReadInt32();
     DeltaX = stream.ReadInt8();
     DeltaY = stream.ReadInt8();
     DeltaZ = stream.ReadInt8();
     Yaw = stream.ReadUInt8();
     Pitch = stream.ReadUInt8();
 }
예제 #14
0
 public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction)
 {
     Slot = stream.ReadInt8();
     return mode;
 }