Browse Source

fix modid detection issue, add coremod detection

tags/0.1.1
asiekierka 3 years ago
parent
commit
cc67766acc

+ 14
- 0
.idea/libraries/com_beust_jcommander_1_48.xml View File

@@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="com.beust:jcommander:1.48" type="repository">
<properties maven-id="com.beust:jcommander:1.48" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48-sources.jar!/" />
</SOURCES>
</library>
</component>

+ 1
- 0
src/pl/asie/modalyze/McmodInfo.java View File

@@ -59,6 +59,7 @@ public class McmodInfo {
info = null;
}
} catch (Exception ee) {
ee.printStackTrace();
info = null;
}
} catch (Exception e) {

+ 15
- 1
src/pl/asie/modalyze/ModAnalyzer.java View File

@@ -5,14 +5,15 @@ import org.objectweb.asm.*;
import pl.asie.modalyze.mcp.MCPDataManager;
import pl.asie.modalyze.mcp.MCPUtils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;

public class ModAnalyzer {
@@ -65,6 +66,7 @@ public class ModAnalyzer {
metadata.valid = true;

if (data.containsKey("modid")) {
metadata.modid = (String) data.get("modid"); // always more accurate
metadata.provides = StringUtils.append(metadata.provides, (String) data.get("modid"));
}

@@ -226,6 +228,16 @@ public class ModAnalyzer {
return metadata;
}

private void appendManifest(ModMetadata metadata, InputStream stream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line;

while ((line = reader.readLine()) != null) {
if (line.startsWith("FMLCorePlugin:")) {
metadata.hasCoremod = true;
}
}
}
private void appendMcmodInfo(ModMetadata metadata, InputStream stream) throws IOException {
McmodInfo info = McmodInfo.get(stream);
if (info != null && info.modList != null) {
@@ -304,6 +316,8 @@ public class ModAnalyzer {
if (meta != null && meta.valid) {
recursiveMods.add(meta);
}
} else if (entry.getName().equals("META-INF/MANIFEST.MF")) {
appendManifest(metadata, stream);
}
}
} catch (ZipException exception) {

+ 1
- 0
src/pl/asie/modalyze/ModMetadata.java View File

@@ -11,6 +11,7 @@ public class ModMetadata {
public String filename, sha256;
public List<String> authors;
public Map<String, String> dependencies;
public boolean hasCoremod;

public transient boolean valid;
}

Loading…
Cancel
Save