ByteBuffer.WriteShort C# (CSharp) Method

WriteShort() public method

public WriteShort ( ushort v ) : void
v ushort
return void
    public void WriteShort(ushort v)
    {
        mBinaryWriter.Write(v);
    }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Spawns "other" to "target"
        /// <para>This is soley used for the first spawn of a player</para>
        /// </summary>
        public static void SpawnEntity(Entity target, Entity other, bool mutual = true)
        {
            if (mutual)
            {
                SpawnEntity(other, target, false);
            }
            if (target.VisibleIDs.Contains(other.EntityID))
            {
                return;
            }
            if (target is Player)
            {
                ByteBuffer buffer = new ByteBuffer(Opcodes.SpawnPlayer.length);
                buffer.WriteByte(Opcodes.SpawnPlayer.id);
                buffer.WriteByte(other.EntityID);
                buffer.WriteString(other.HoverName, Encoding.ASCII);
                buffer.WriteShort(other.Position.X);
                buffer.WriteShort(other.Position.Y);
                buffer.WriteShort(other.Position.Z);
                buffer.WriteByte(other.Rotation.X);
                buffer.WriteByte(other.Rotation.Y);
                ((Player)target).SendRaw(buffer.Data);
            }

            target.VisibleIDs.Add(other.EntityID);
            if (mutual)
            {
                SpawnEntity(other, target, false);
            }
        }
All Usage Examples Of ByteBuffer::WriteShort