From a9969c4f1eefdab8518be0e07395508b112b4924 Mon Sep 17 00:00:00 2001 From: Luke Bemish Date: Sun, 15 Sep 2024 17:18:52 -0500 Subject: [PATCH] Change mod ID regex to allow '.' in mod IDs --- .../net/neoforged/fml/loading/moddiscovery/ModInfo.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java index e9fd89c67..2dec36e52 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java @@ -29,7 +29,11 @@ public class ModInfo implements IModInfo, IConfigurable { private static final Logger LOGGER = LogUtils.getLogger(); private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1"); - private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$"); + // 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+.*");