Fix include generating modid's that are too long for loader
Co-authored-by: NebelNidas <burnerjulian@gmail.com>
This commit is contained in:
parent
e985cb85d4
commit
63f2b51b2c
1 changed files with 10 additions and 1 deletions
|
@ -33,6 +33,7 @@ import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
@ -172,10 +173,18 @@ public final class IncludedJarFactory {
|
||||||
|
|
||||||
// Generates a barebones mod for a dependency
|
// Generates a barebones mod for a dependency
|
||||||
private static String generateModForDependency(Metadata metadata) {
|
private static String generateModForDependency(Metadata metadata) {
|
||||||
final String modId = (metadata.group() + "_" + metadata.name() + metadata.classifier())
|
String modId = (metadata.group() + "_" + metadata.name() + metadata.classifier())
|
||||||
.replaceAll("\\.", "_")
|
.replaceAll("\\.", "_")
|
||||||
.toLowerCase(Locale.ENGLISH);
|
.toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
|
// Fabric Loader can't handle modIds longer than 64 characters
|
||||||
|
if (modId.length() > 64) {
|
||||||
|
String hash = Hashing.sha256()
|
||||||
|
.hashString(modId, StandardCharsets.UTF_8)
|
||||||
|
.toString();
|
||||||
|
modId = modId.substring(0, 50) + hash.substring(0, 14);
|
||||||
|
}
|
||||||
|
|
||||||
final JsonObject jsonObject = new JsonObject();
|
final JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("schemaVersion", 1);
|
jsonObject.addProperty("schemaVersion", 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue