Something that needs to happen: warn people about bad modids- if they're not lowercased, or if they're too long.
This commit is contained in:
parent
cc0e6a1825
commit
45b299ce06
2 changed files with 23 additions and 1 deletions
|
@ -29,6 +29,7 @@ import java.net.URL;
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -50,6 +51,7 @@ import net.minecraftforge.fml.common.versioning.VersionParser;
|
||||||
import net.minecraftforge.fml.common.versioning.VersionRange;
|
import net.minecraftforge.fml.common.versioning.VersionRange;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
@ -119,8 +121,24 @@ public class FMLModContainer implements ModContainer
|
||||||
this.languageAdapter = null;
|
this.languageAdapter = null;
|
||||||
FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId());
|
FMLLog.finer("Using custom language adapter %s for %s (modid: %s)", languageAdapterType, this.className, getModId());
|
||||||
}
|
}
|
||||||
|
sanityCheckModId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sanityCheckModId()
|
||||||
|
{
|
||||||
|
String modid = (String)this.descriptor.get("modid");
|
||||||
|
if (Strings.isNullOrEmpty(modid))
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Modid cannot be null or empty");
|
||||||
|
}
|
||||||
|
if (modid.length() > 64) {
|
||||||
|
FMLLog.bigWarning("The modid %s is longer than the recommended maximum of 64 characters. Truncation will be enforced in 1.11", modid);
|
||||||
|
}
|
||||||
|
if (!modid.equals(modid.toLowerCase(Locale.ENGLISH)))
|
||||||
|
{
|
||||||
|
FMLLog.bigWarning("The modid %s is not the same as it's lowercase version. Lowercasing will be enforced in 1.11", modid);
|
||||||
|
}
|
||||||
|
}
|
||||||
private ILanguageAdapter getLanguageAdapter()
|
private ILanguageAdapter getLanguageAdapter()
|
||||||
{
|
{
|
||||||
if (languageAdapter == null)
|
if (languageAdapter == null)
|
||||||
|
|
|
@ -75,7 +75,11 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
public @interface Mod
|
public @interface Mod
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The unique mod identifier for this mod
|
* The unique mod identifier for this mod.
|
||||||
|
* <b>Required to be lowercased in the english locale for compatibility. Will be truncated to 64 characters long.</b>
|
||||||
|
*
|
||||||
|
* This will be used to identify your mod for third parties (other mods), it will be used to identify your mod for registries such as block and item registries.
|
||||||
|
* By default, you will have a resource domain that matches the modid. All these uses require that constraints are imposed on the format of the modid.
|
||||||
*/
|
*/
|
||||||
String modid();
|
String modid();
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue