3

Am trying to figure out where to look for finding out the current version of minecraft installed my pc. I can see the current version, if I open up the Minecraft.exe launcher.

enter image description here

I tried to search in Windows Registry to see if there is any entry regarding the current version. But didn't found any when I searched for the term minecraft. And I can see that, this folder C:\Users\USERNAME\AppData\Roaming\.minecraft\versions contains the sub-folder 1.7.4 which is the current version!

So, is that the only place we can check to find out the current version?

I am trying to fetch the version via code (creating VB.Net app). I can do a scan for the sub-folders in the ..\.minecraft\versions folder and could find out the version number. But what if that versions folder contains another folder say 1.8.2 with a JAR and JSON file? My idea of fetching the current version would fail then! Because the versions folder contains two folders 1.7.4 (which is the current version) and the 1.8.2 (which is a duplicate of the contents of the folder 1.7.4, I created for testing). In my code, it would find out the current version as 1.8.2, which would be wrong! Because when the MC launcher is opened, it still shows the 1.7.4 as the current version!

So, what would be the effective way/place to look for finding the currently installed version? Any hints would be highly appreciated.

Thank you

  • You may need to read the json file in each folder and compare their "releaseTime". – Kcats Dec 19 '13 at 8:28
  • May be borderline StackOverflow material, but I think this is okay. For the question itself though, as long as you didn't create a folder named 1.8.2 in it, would it work? Or is the idea that you could backdate and then receive the version currently in use? It's probably obvious, but I can't make heads or tails of code-speak to save my life :) – The Ugly Dec 19 '13 at 14:33
1

I just checked the launcher and this is how it does it:

It loads .minecraft\launcher_profiles.json and looks at "selectedProfile":

  {
    "profiles": {
      "1.6.4": {
        "name": "1.6.4",
        "lastVersionId": "1.6.4",
        "playerUUID": "---"
      },
      "default": {
        "name": "default",
        "playerUUID": "---",
        "launcherVisibilityOnGameClose": "close launcher when game starts"
      }
    },
    "selectedProfile": "default",
    "clientToken": "---",
  }

Then it looks at the selected profile's lastVersionId and uses that version (e.g. 1.6.4). If there is no such attribute (as in the above example), it lists all versions from the versions folder, reads the json files and chooses the one with latest "releaseTime" attribute. It also filters the versions by "type" == "release" attribute (this filtering actually depends on the profile settings, but by default only "release" versions are considered).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.