Exemplo n.º 1
0
 public override void Read(PrimitiveReader reader)
 {
     Position = new Vec3(reader.ReadDouble(), reader.ReadDouble(), reader.ReadDouble());
     Yaw      = reader.ReadFloat();
     Pitch    = reader.ReadFloat();
     OnGround = reader.ReadBool();
 }
Exemplo n.º 2
0
        public override void Read(PrimitiveReader reader)
        {
            Sideways = reader.ReadFloat();
            Forward  = reader.ReadFloat();
            var flags = reader.ReadByte();

            if ((flags & 0x01) != 0)
            {
                Jump = true;
            }
            if ((flags & 0x02) != 0)
            {
                Unmount = true;
            }
        }
Exemplo n.º 3
0
        public override void Read(PrimitiveReader reader)
        {
            Location = reader.ReadBlockPosProto();
            var facing = reader.ReadVarint();

            Facing = Facing.GetFromValue((byte)facing);
            if (Facing == null)
            {
                throw new InvalidPacketException(nameof(Facing), facing);
            }
            Hand = (Hand)reader.ReadVarint();
            if (!Hand.IsValid())
            {
                throw new InvalidPacketException(nameof(Hand), Hand);
            }
            CursorPosX = reader.ReadFloat();
            CursorPosY = reader.ReadFloat();
            CursorPosZ = reader.ReadFloat();
        }
Exemplo n.º 4
0
 public override void Read(PrimitiveReader reader)
 {
     TargetEntityId = reader.ReadVarint();
     Type           = (TypeEnum)reader.ReadVarint();
     if (!(Type == TypeEnum.Interact || Type == TypeEnum.Attack || Type == TypeEnum.InteractAt))
     {
         throw new InvalidPacketException(nameof(Type), Type);
     }
     if (Type == TypeEnum.InteractAt)
     {
         TargetPos = new Vec3(reader.ReadFloat(), reader.ReadFloat(), reader.ReadFloat());
     }
     if (Type == TypeEnum.Interact || Type == TypeEnum.InteractAt)
     {
         Hand = (Hand)reader.ReadVarint();
         if (!Hand.IsValid())
         {
             throw new InvalidPacketException(nameof(Hand), Hand);
         }
     }
 }
Exemplo n.º 5
0
        public override void Read(PrimitiveReader reader)
        {
            var flags = reader.ReadByte();

            if ((flags & 0x01) != 0)
            {
                IsCreative = true;
            }
            if ((flags & 0x02) != 0)
            {
                IsFlying = true;
            }
            if ((flags & 0x04) != 0)
            {
                CanFly = true;
            }
            if ((flags & 0x08) != 0)
            {
                GodMode = true;
            }
            FlyingSpeed  = reader.ReadFloat();
            WalkingSpeed = reader.ReadFloat();
        }
Exemplo n.º 6
0
 public override void Read(PrimitiveReader reader)
 {
     Yaw   = reader.ReadFloat();
     Pitch = reader.ReadFloat();
 }
Exemplo n.º 7
0
 internal override void Read(PrimitiveReader reader, int _) => Value = reader.ReadFloat();