Example #1
0
 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);
     }
 }
Example #2
0
 internal void Write(PacketWriter stream)
 {
     stream.Write(Type > 0 ? Type : (short)-1);
     if (Type > 0)
     {
         stream.Write(Count);
         stream.Write(Durability);
     }
 }
Example #3
0
        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);
                 * }
                 */
            }
        }
Example #4
0
 internal void WriteEnchantmentsToNBT(PacketWriter stream)
 {
     // TODO: Implement this
     /*      Gzip the nbt representing enchantments
      *      write the gzipped output length
      *      write output
      */
 }
Example #5
0
 internal void ReadEnchantmentsFromNBT(PacketWriter stream)
 {
     // TODO: Implement this and choose return value
 }