Write() public method

public Write ( bool data ) : void
data bool
return void
Ejemplo n.º 1
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     if (version >= 38)
     {
         writer.Write(Code);
         writer.Write((byte) EntityIds.Count ());
         foreach (int item in EntityIds)
         {
             writer.Write(item);
         }
     }
     else
     {
         if (EntityIds == null || EntityIds.Count () == 0)
         {
             writer.Write(Code);
             writer.Write(0);
         }
         else
             foreach (int item in EntityIds)
             {
                 writer.Write(Code);
                 writer.Write(item);
             }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(TeamName);
            writer.Write(Mode);
            if (Mode == 2 || Mode == 0)
            {
                writer.Write(TeamDisplayName);
                writer.Write(TeamPrefix);
                writer.Write(TeamSufix);
                if (version >= 60)
                    writer.Write(FriendlyFire);
                else
                    writer.Write(FriendlyFire != 0);
            }

            Players = Players ?? new string[0];
            writer.Write(PlayerCount);
            if (Mode == 0 || Mode == 3 || Mode == 4)
            {
                foreach (var player in Players)
                {
                    writer.Write(player);
                }
            }
        }
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(ResponseType);
 }
Ejemplo n.º 4
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(Number);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Sends the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="version">The version.</param>
        /// <remarks></remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            if (version >= 32)
            {
                byte d = 0;

                d |= (byte)((Flying ? 1 : 0) << 0);
                d |= (byte)((InstantBuild ? 1 : 0) << 1);
                d |= (byte)((MayFly ? 1 : 0) << 2);
                d |= (byte)((Invulnerable ? 1 : 0) << 3);
                writer.Write(d);
                writer.Write(FlyingSpeed);
                writer.Write(WalkSpeed);
            }
            else
            {
                writer.Write(Flying);
                writer.Write(InstantBuild);
                writer.Write(MayFly);
                writer.Write(Invulnerable);
            }
        }
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(StatisticId);
     writer.Write(Amount);
 }
Ejemplo n.º 7
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(EntityId);
     MetadataInfo.WriteMetadata(InnerData, writer);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(Health);
     writer.Write(Food);
     writer.Write(FoodSaturation);
 }
Ejemplo n.º 9
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(WindowId);
     writer.Write(Count);
     InventoryPacket.WritePayload(writer, Items);
 }
Ejemplo n.º 10
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(UserEntity);
     writer.Write(TargetEntity);
     writer.Write(LeftClick);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(WindowId);
     writer.Write(ProgressBarType);
     writer.Write(Value);
 }
Ejemplo n.º 12
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(MessageColor);
            writer.WriteClassicString(TextMessage);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(EntityId);
     writer.Write(Yaw);
     writer.Write(Pitch);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(WindowId);
     writer.Write(ActionNumber);
     writer.Write(Accepted);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(PlayerName);
     writer.Write(Online);
     writer.Write(Ping);
 }
Ejemplo n.º 16
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(WindowId);
     writer.Write(Slot);
     writer.Write(Item);
 }
Ejemplo n.º 17
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(CurrentExperience);
     writer.Write(Level);
     writer.Write(TotalExperience);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(EntityId);
     writer.Write(EffectId);
     writer.Write(Amplifier);
     writer.Write(Duration);
 }
Ejemplo n.º 19
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(ScoreboardName);
            writer.Write(ScoreboardDispayText);
            writer.Write(CreateRemove);
        }
Ejemplo n.º 20
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(EntityId);
     writer.Write(ActionId);
     if (version >= 72)
         writer.Write(Unknown);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(WindowId);
     writer.Write(InventoryType);
     writer.Write(WindowTitle);
     writer.Write(Slots);
 }
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(ProtocolVersion);
     writer.WriteClassicString(Username);
     writer.WriteClassicString(VerificationKey);
     writer.Write(Unused);
 }
Ejemplo n.º 23
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(Sideways);
            writer.Write(Forward);
            writer.Write(Jump);
            writer.Write(Unmount);
        }
Ejemplo n.º 24
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(ItemName);
            writer.Write(UpdateRemove);
            writer.Write(ScoreName);
            writer.Write(Value);
        }
Ejemplo n.º 25
0
 /// <summary>
 ///   Sends the specified writer.
 /// </summary>
 /// <param name="writer"> The writer. </param>
 /// <param name="version"> The version. </param>
 /// <remarks>
 /// </remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(StatisticId);
     if (version >= 72)
         writer.Write(Amount);
     else
         writer.Write((byte) Amount);
 }
Ejemplo n.º 26
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            writer.Write(PlayerID);
            writer.Write(ChangeX);
            writer.Write(ChangeY);
            writer.Write(ChangeZ);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new System.ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(Unknown1);
     writer.Write(Unknown2);
     writer.Write(Unknown3);
     writer.Write(Unknown4);
     writer.Write(Unknown5);
     writer.Write(Unknown6);
 }
Ejemplo n.º 28
0
        /// <summary>
        ///   Sends the specified writer.
        /// </summary>
        /// <param name="writer"> The writer. </param>
        /// <param name="version"> The version. </param>
        /// <remarks>
        /// </remarks>
        protected override void OnSend(BigEndianStream writer, int version)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");
            writer.Write(Code);

            byte[] data = ChunkData.ToArray ();

            writer.Write((short) data.Length);
            writer.Write(data);
            writer.Write(PercentComplete);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(PositionX);
     writer.Write(PositionY);
     writer.Write(PositionZ);
     writer.Write(Byte1);
     writer.Write(Byte2);
     if (version >= 38)
         writer.Write(UnknownInt16);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Sends the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="version">The version.</param>
 /// <remarks></remarks>
 protected override void OnSend(BigEndianStream writer, int version)
 {
     if (writer == null)
         throw new ArgumentNullException("writer");
     writer.Write(Code);
     writer.Write(PositionX);
     writer.Write(PositionY);
     writer.Write(PositionZ);
     if (version >= 38)
         writer.Write(BlockType);
     else
         writer.Write((byte)BlockType);
     writer.Write(BlockMetadata);
 }