Is it still possible to set your username in offline mode in Minecraft 1.6 and later? [duplicate]

Yep it is, although a bit more of a hassle than it used to be.

First, disconnect your internet and go to your .minecraft folder. Directly in the .minecraft folder should be a file called launcher_profiles.json (1.16.4+: launcher_accounts.json); open it up with any text editor. The very last part before the } }} should show "displayName": and then your name in quotation marks. Edit your name to whatever you want to change your name to and then save it and open up the launcher.

Because your internet is disconnected it will only let you play on offline mode. You need to keep your internet disconnected until you click "Play offline" on the launcher, otherwise it will connect and realise your username is wrong.

Once the game has started you're free to reconnect to your internet, and you should have the name you chose. This will only work on singleplayer and servers with offline mode on, not LAN or online servers.

This literally just changes your display name, so if anybody else is wondering, it can not be used to pirate the game or anything like that.