Ejemplo n.º 1
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteDouble(Position.X);
     writer.WriteDouble(Position.Y);
     writer.WriteDouble(Position.Z);
     writer.WriteFloat(Yaw);
     writer.WriteFloat(Pitch);
 }
Ejemplo n.º 2
0
        public override void Write(PrimitiveWriter writer)
        {
            writer.WriteUuidProto(Bossbar.Uuid);
            writer.WriteVarint((int)Action);
            switch (Action)
            {
            case ActionEnum.Add:
                writer.WriteChatRootProto(Bossbar.Title);
                writer.WriteFloat(Bossbar.Health);
                writer.WriteVarint((int)Bossbar.Color);
                writer.WriteVarint((int)Bossbar.Division);
                byte x = 0;
                if (Bossbar.ShouldDarkenSky)
                {
                    x |= 0x1;
                }
                if (Bossbar.IsDragonBar)
                {
                    x |= 0x02;
                }
                writer.WriteByte(x);
                break;

            case ActionEnum.Remove:
                break;

            case ActionEnum.UpdateHealth:
                writer.WriteFloat(Bossbar.Health);
                break;

            case ActionEnum.UpdateTitle:
                writer.WriteChatRootProto(Bossbar.Title);
                break;

            case ActionEnum.UpdateStyle:
                writer.WriteVarint((int)Bossbar.Color);
                writer.WriteVarint((int)Bossbar.Division);
                break;

            case ActionEnum.UpdateFlags:
                byte z = 0;
                if (Bossbar.ShouldDarkenSky)
                {
                    z |= 0x1;
                }
                if (Bossbar.IsDragonBar)
                {
                    z |= 0x02;
                }
                writer.WriteByte(z);
                break;

            default:
                throw new InvalidOperationException($"Invalid ActionEnum: {Action}");
            }
        }
Ejemplo n.º 3
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteStringProto(Name);
     writer.WriteVarint(Category.Id);
     writer.WriteInt((int)(Position.X * 8));
     writer.WriteInt((int)(Position.Y * 8));
     writer.WriteInt((int)(Position.Z * 8));
     writer.WriteFloat(Volume);
     writer.WriteFloat(Pitch);
 }
Ejemplo n.º 4
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteDouble(Position.X);
     writer.WriteDouble(Position.Y);
     writer.WriteDouble(Position.Z);
     writer.WriteFloat(Yaw);
     writer.WriteFloat(Pitch);
     writer.WriteByte((byte)Flags);
     writer.WriteVarint(TeleportId);
 }
Ejemplo n.º 5
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     writer.Write(this.Position.X);
     writer.Write(this.Position.Y);
     writer.Write(this.Position.Z);
     writer.WriteFloat(this.Orientation);
 }
Ejemplo n.º 6
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     // UpdateFlag.HasPosition
     writer.Write(Position.X);
     writer.Write(Position.Y);
     writer.Write(Position.Z);
     writer.WriteFloat(Orientation);
 }
Ejemplo n.º 7
0
        public override void Write(PrimitiveWriter writer)
        {
            byte x = 0;

            if (Invulnerable)
            {
                x |= 0x01;
            }
            if (Flying)
            {
                x |= 0x02;
            }
            if (AllowFlying)
            {
                x |= 0x03;
            }
            if (CreativeMode)
            {
                x |= 0x08;
            }
            writer.WriteByte(x);
            writer.WriteFloat(FlyingSpeed);
            writer.WriteFloat(FieldOfView);
        }
Ejemplo n.º 8
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteFloat((float)Location.X);
     writer.WriteFloat((float)Location.Y);
     writer.WriteFloat((float)Location.Z);
     writer.WriteFloat(Radius);
     writer.WriteInt(Records.Count);
     foreach (var r in Records)
     {
         writer.WriteByte((byte)(r.X - (int)Location.X));
         writer.WriteByte((byte)(r.Y - (int)Location.Y));
         writer.WriteByte((byte)(r.Z - (int)Location.Z));
     }
     writer.WriteFloat((float)PlayerVelocity.X);
     writer.WriteFloat((float)PlayerVelocity.Y);
     writer.WriteFloat((float)PlayerVelocity.Z);
 }
Ejemplo n.º 9
0
 protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
 {
     if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObjectOnTransport))
     {
         EntityId.Zero.WritePacked(packet);
         packet.Write(Position);
         packet.Write(Position);
         packet.Write(Orientation);
         packet.Write(0.0f);
     }
     else
     {
         if (!UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObject))
         {
             return;
         }
         packet.Write(Position);
         packet.WriteFloat(Orientation);
     }
 }
Ejemplo n.º 10
0
        protected override void WriteMovementUpdate(PrimitiveWriter packet, UpdateFieldFlags relation)
        {
            if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObjectOnTransport))
            {
                // corpses had this, but seemed to just send their own info for both
                EntityId.Zero.WritePacked(packet);
                packet.Write(Position);
                packet.Write(Position); // transport position, but server seemed to send normal position except orientation
                packet.Write(Orientation);
                packet.Write(Orientation);
            }
            else if (UpdateFlags.HasAnyFlag(UpdateFlags.StationaryObject))
            {
                #region UpdateFlag.Flag_0x40 (StationaryObject)

                packet.Write(Position);
                packet.WriteFloat(Orientation);

                #endregion
            }
        }
Ejemplo n.º 11
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteInt(Particle.Id);
     writer.WriteBool(LongDistance);
     writer.WriteFloat((float)Position.X);
     writer.WriteFloat((float)Position.Y);
     writer.WriteFloat((float)Position.Z);
     writer.WriteFloat((float)Offset.X);
     writer.WriteFloat((float)Offset.Y);
     writer.WriteFloat((float)Offset.Z);
     writer.WriteFloat(Speed);
     writer.WriteInt(Count);
     if (Data == null)
     {
         return;
     }
     foreach (var i in Data)
     {
         writer.WriteInt(i);
     }
 }
Ejemplo n.º 12
0
 protected override void WriteMovementUpdate(PrimitiveWriter writer, UpdateFieldFlags relation)
 {
     // UpdateFlag.StationaryObject
     writer.Write(Position);
     writer.WriteFloat(Orientation);
 }
Ejemplo n.º 13
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteByte(Reason);
     writer.WriteFloat(Value);
 }
Ejemplo n.º 14
0
 internal override void Write(PrimitiveWriter writer) => writer.WriteFloat(Value);
Ejemplo n.º 15
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteFloat(ExperienceBar);
     writer.WriteVarint(Level);
     writer.WriteVarint(TotalExperience);
 }
Ejemplo n.º 16
0
 public override void Write(PrimitiveWriter writer)
 {
     writer.WriteFloat(Health);
     writer.WriteVarint(Food);
     writer.WriteFloat(FoodSaturation);
 }