Skip to content

Commit

Permalink
Actually add mod ID format to the contract of getModId()
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Sep 17, 2024
1 parent a9969c4 commit 4221cd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
public class ModInfo implements IModInfo, IConfigurable {
private static final Logger LOGGER = LogUtils.getLogger();
private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1");
// Mod IDs must:
// - be from 2 to 64 characters long
// - contain only lowercase letters, digits, underscores, and periods, to satisfy both java module and resource location namespace requirements
// - each dot-separated section must start with a lowercase letter (they must be java identifiers)
private static final Pattern VALID_MODID = Pattern.compile("^(?=.{2,64}$)[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$");
private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$");
private static final Pattern VALID_VERSION = Pattern.compile("^\\d+.*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ public interface IModInfo {
*/
IModLanguageLoader getLoader();

/**
* {@return the mod id}
* Mod IDs must satisfy the following requirements:
* <ul>
* <li>be from 2 to 64 characters long
* <li>contain only lowercase letters, digits, underscores, and periods
* <li>each dot-separated section must start with a lowercase letter
* </ul>
*/
String getModId();

String getDisplayName();
Expand Down

0 comments on commit 4221cd5

Please sign in to comment.