-
When my mod is ran, one of the following exceptions is thrown and the game will not start:
How can I fix this exception so that I can launch the game with my mod? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When registering content for your mod, you must ensure that identifiers (the internal names given to registered content) follow the rules for identifier namespaces and paths. Your code may contain code such as the following: // 'MODID' is an invalid namespace here
Identifier invalidId1 = Identifier.of("MODID", "test_content");
Identifier invalidId2 = Identifier.of("MODID:test_content");
// 'TestContent' is an invalid path here
Identifier invalidId3 = Identifier.of("modid", "TestContent");
Identifier invalidId4 = Identifier.of("modid:TestContent"); This code will throw an exception because the identifiers do not follow the correct format. There are a few rules to consider:
You can change your identifier to match these rules by making letters lowercase and removing or replacing characters that are not allowed. A common way identifiers are chosen is to take the name of the content, such as 'Iron Ingot', and then transforming it to snake case by making it lowercase and replacing spaces with underscores. This value, such as A valid identifier might look like the following: Identifier validId1 = Identifier.of("modid", "test_content");
Identifier validId2 = Identifier.of("modid:test_content"); With the changes made to all invalid identifiers (you can search for the invalid namespace or path in your code to find where it is being sourced from), the game with your mod loaded should be able to launch correctly. |
Beta Was this translation helpful? Give feedback.
When registering content for your mod, you must ensure that identifiers (the internal names given to registered content) follow the rules for identifier namespaces and paths. Your code may contain code such as the following:
This code will throw an exception because the identifiers do not follow the correct format. There are a few rules to consider: