-
Bug
-
Resolution: Fixed
-
None
-
Minecraft 1.11.2
-
Confirmed
-
(Unassigned)
Based on 1.11.2 decompiled using MCP 9.35 rc1
The bug
The method net.minecraft.client.main.Main.main(String[]) uses the player name as value for the UUID if none is provided. This causes NullPointerException s when trying to connect to servers and prevents you from joining LAN worlds because the default player name is not a valid UUID.
As Minecraft defaults the player name already the expected behavior would be that it defaults the UUID as well. If possible to a static UUID to prevent the creation of multiple playerdata files.
Important: It would be good if Minecraft printed a warning or info message if either playername or UUID is not set (!optionset.has(...)) to not confuse the player if he suddenly has a different name or gets invalid session error messages when trying to join servers and to make it easier to identify when the launcher did not provide these arguments.
public static void main(String[] p_main_0_) { OptionParser optionparser = new OptionParser(); //... OptionSpec<String> optionspec9 = optionparser.accepts("username").withRequiredArg().defaultsTo("Player" + Minecraft.getSystemTime() % 1000L, new String[0]); // Replaced this // OptionSpec<String> optionspec10 = optionparser.accepts("uuid").withRequiredArg(); OptionSpec<String> optionspec10 = optionparser.accepts("uuid").withRequiredArg().defaultsTo("e8b18103-b139-4bd2-b4d4-958ade7e319d"); //... OptionSet optionset = optionparser.parse(p_main_0_); //... File file2 = optionset.has(optionspec3) ? optionset.valueOf(optionspec3) : new File(file1, "assets/"); File file3 = optionset.has(optionspec4) ? optionset.valueOf(optionspec4) : new File(file1, "resourcepacks/"); // Replaced this // String s5 = optionset.has(optionspec10) ? (String)optionspec10.value(optionset) : (String)optionspec9.value(optionset); String s5 = optionspec10.value(optionset); //... Session session = new Session((String)optionspec9.value(optionset), s5, (String)optionspec11.value(optionset), (String)optionspec18.value(optionset)); //... }
- relates to
-
MC-113337 java.lang.NullPointerException when trying to join servers
- Resolved