コード例 #1
0
ファイル: MetaData.cs プロジェクト: IdentErr/c-raft
 internal void Write(PacketWriter tx)
 {
     try // I can't work out how it set this from SpawnAnimal.
     {
         foreach (int k in Data.Keys)
         {
             Type type = Data[k].GetType();
             if (type == typeof(byte))
             {
                 tx.WriteByte((byte)k);
                 tx.Write((byte)Data[k]);
             }
             else if (type == typeof(short))
             {
                 tx.WriteByte((byte)(0x20 | k));
                 tx.Write((short)Data[k]);
             }
             else if (type == typeof(int))
             {
                 tx.WriteByte((byte)(0x40 | k));
                 tx.Write((int)Data[k]);
             }
             else if (type == typeof(float))
             {
                 tx.WriteByte((byte)(0x60 | k));
                 tx.Write((float)Data[k]);
             }
             else if (type == typeof(string))
             {
                 tx.WriteByte((byte)(0x80 | k));
                 tx.Write((string)Data[k]);
             }
         }
     }
     catch { }
     finally
     {
         tx.WriteByte(0x7f);
     }
 }
コード例 #2
0
ファイル: ItemStack.cs プロジェクト: IdentErr/c-raft
 internal void Write(PacketWriter stream)
 {
     stream.Write(Type > 0 ? Type : (short)-1);
     if (Type > 0)
     {
         stream.Write(Count);
         stream.Write(Durability);
     }
 }
コード例 #3
0
ファイル: ItemStack.cs プロジェクト: UrbanLetsPlay/c-raft
        internal void Write(PacketWriter stream)
        {
            stream.Write(Type > 0 ? Type : (short)-1);
            if (Type > 0)
            {
                stream.Write(Count);
                stream.Write(Durability);

                //if (Durability > 0 || IsEnchantable())
                    stream.Write((short)-1);
                // TODO: Remove the two lines above and implement items and enchantments write
                /*
                 * if (Item.CanBeDamaged())
                 * {
                 *      if(_enchantments != null)
                 *          WriteEnchantmentsToNBT(stream);
                 *      else
                 *          stream.Write(-1);
                 * }
                 */
            }
        }
コード例 #4
0
ファイル: ItemStack.cs プロジェクト: UrbanLetsPlay/c-raft
 internal void WriteEnchantmentsToNBT(PacketWriter stream)
 {
     // TODO: Implement this
     /*      Gzip the nbt representing enchantments
      *      write the gzipped output length
      *      write output
      */
 }
コード例 #5
0
ファイル: ItemStack.cs プロジェクト: UrbanLetsPlay/c-raft
 internal void ReadEnchantmentsFromNBT(PacketWriter stream)
 {
     // TODO: Implement this and choose return value
 }