Added informative exception when attempting to register a channel using a modID > 20 characters

This commit is contained in:
Chicken-Bomes committed 2014-06-29 14:27:19 +10:00
1 parent 93b1e5dbf0
commit ba15e4b116
1 file changed
+6 -2
+6 -2
View File
@@ -145,8 +145,12 @@ public final class PacketCustom implements MCDataInput, MCDataOutput
public static String channelName(Object channelKey) {
if (channelKey instanceof String)
return (String) channelKey;
if (channelKey instanceof ModContainer)
return ((ModContainer) channelKey).getModId();
if (channelKey instanceof ModContainer) {
String s = ((ModContainer) channelKey).getModId();
if(s.length() > 20)
throw new IllegalArgumentException("Mod ID ("+s+") too long for use as channel (20 chars). Use a string identifier");
return s;
}
ModContainer mc = FMLCommonHandler.instance().findContainerFor(channelKey);
if (mc != null)