コード例 #1
0
ファイル: ItemStack.cs プロジェクト: IdentErr/c-raft
 internal ItemStack(BigEndianStream stream)
 {
     Type = stream.ReadShort();
     if (Type >= 0)
     {
         Count = stream.ReadSByte();
         Durability = stream.ReadShort();
     }
 }
コード例 #2
0
ファイル: ItemStack.cs プロジェクト: UrbanLetsPlay/c-raft
        internal ItemStack(BigEndianStream stream)
        {
            Type = stream.ReadShort();
            if (Type >= 0)
            {
                Count = stream.ReadSByte();
                Durability = stream.ReadShort();

                // TODO: Implement extra data read (enchantment) and items
                if (Durability > 0 || IsEnchantable())
                    stream.ReadShort();
            }
        }
コード例 #3
0
ファイル: MetaData.cs プロジェクト: RevolutionSmythe/c-raft
 internal MetaData(BigEndianStream rx)
 {
     byte x;
     while ((x = rx.ReadByte()) != 0x7f)
     {
         switch (x >> 5)
         {
             case 0: Data[x & 0x1f] = rx.ReadByte(); break;
             case 1: Data[x & 0x1f] = rx.ReadShort(); break;
             case 2: Data[x & 0x1f] = rx.ReadInt(); break;
             case 3: Data[x & 0x1f] = rx.ReadFloat(); break;
             case 4: Data[x & 0x1f] = rx.ReadString16(64); break;
             default: Data[x & 0x1f] = null; break;
         }
     }
 }
コード例 #4
0
ファイル: MapChunkPacket.cs プロジェクト: cyberdudedk/c-raft
        public override void Read(BigEndianStream stream)
        {
            int posX = stream.ReadInt();
            short posY = stream.ReadShort();
            int posZ = stream.ReadInt();
            byte sizeX = (byte)(stream.ReadByte() + 1);
            byte sizeY = (byte)(stream.ReadByte() + 1);
            byte sizeZ = (byte)(stream.ReadByte() + 1);

            int o = sizeX * sizeY * sizeZ;
            Chunk = new Chunk(null, posX, posZ);

            int len = stream.ReadInt();
            byte[] comp = new byte[len];
            byte[] data = new byte[o * 5 / 2];
            len = stream.Read(comp, 0, len);
        }
コード例 #5
0
ファイル: ItemHelper.cs プロジェクト: TheaP/c-raft
 public static ItemInventory GetInstance(BigEndianStream stream)
 {
     ItemInventory item = Void;
     Type itemClass;
     short type = stream.ReadShort();
     if (type >= 0)
     {
         if (_itemClasses.TryGetValue(type, out itemClass))
         {
             item = (ItemInventory) itemClass.GetConstructor(Type.EmptyTypes).Invoke(null);
             item.Count = stream.ReadSByte();
             item.Durability = stream.ReadShort();
             // TODO: Implement extra data read (enchantment) and items
             //if (item.Durability > 0 || item.IsEnchantable)
                 stream.ReadShort();
         }
     }
     return item;
 }
コード例 #6
0
ファイル: ItemStack.cs プロジェクト: dredge20/c-raft
 internal static ItemStack Read(BigEndianStream stream)
 {
     ItemStack retval = new ItemStack(stream.ReadShort());
     if (retval.Type >= 0)
     {
         retval.Count = stream.ReadSByte();
         retval.Durability = stream.ReadShort();
     }
     return retval;
 }