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 @@
1
+<component name="libraryTable">
2
+  <library name="com.beust:jcommander:1.48" type="repository">
3
+    <properties maven-id="com.beust:jcommander:1.48" />
4
+    <CLASSES>
5
+      <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48.jar!/" />
6
+    </CLASSES>
7
+    <JAVADOC>
8
+      <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48-javadoc.jar!/" />
9
+    </JAVADOC>
10
+    <SOURCES>
11
+      <root url="jar://$MAVEN_REPOSITORY$/com/beust/jcommander/1.48/jcommander-1.48-sources.jar!/" />
12
+    </SOURCES>
13
+  </library>
14
+</component>

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

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

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

@@ -5,14 +5,15 @@ import org.objectweb.asm.*;
5 5
 import pl.asie.modalyze.mcp.MCPDataManager;
6 6
 import pl.asie.modalyze.mcp.MCPUtils;
7 7
 
8
+import java.io.BufferedReader;
8 9
 import java.io.File;
9 10
 import java.io.FileInputStream;
10 11
 import java.io.IOException;
11 12
 import java.io.InputStream;
13
+import java.io.InputStreamReader;
12 14
 import java.util.*;
13 15
 import java.util.zip.ZipEntry;
14 16
 import java.util.zip.ZipException;
15
-import java.util.zip.ZipFile;
16 17
 import java.util.zip.ZipInputStream;
17 18
 
18 19
 public class ModAnalyzer {
@@ -65,6 +66,7 @@ public class ModAnalyzer {
65 66
             metadata.valid = true;
66 67
 
67 68
             if (data.containsKey("modid")) {
69
+                metadata.modid = (String) data.get("modid"); // always more accurate
68 70
                 metadata.provides = StringUtils.append(metadata.provides, (String) data.get("modid"));
69 71
             }
70 72
 
@@ -226,6 +228,16 @@ public class ModAnalyzer {
226 228
         return metadata;
227 229
     }
228 230
 
231
+    private void appendManifest(ModMetadata metadata, InputStream stream) throws IOException {
232
+        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
233
+        String line;
234
+
235
+        while ((line = reader.readLine()) != null) {
236
+            if (line.startsWith("FMLCorePlugin:")) {
237
+                metadata.hasCoremod = true;
238
+            }
239
+        }
240
+    }
229 241
     private void appendMcmodInfo(ModMetadata metadata, InputStream stream) throws IOException {
230 242
         McmodInfo info = McmodInfo.get(stream);
231 243
         if (info != null && info.modList != null) {
@@ -304,6 +316,8 @@ public class ModAnalyzer {
304 316
                     if (meta != null && meta.valid) {
305 317
                         recursiveMods.add(meta);
306 318
                     }
319
+                } else if (entry.getName().equals("META-INF/MANIFEST.MF")) {
320
+                    appendManifest(metadata, stream);
307 321
                 }
308 322
             }
309 323
         } catch (ZipException exception) {

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

@@ -11,6 +11,7 @@ public class ModMetadata {
11 11
     public String filename, sha256;
12 12
     public List<String> authors;
13 13
     public Map<String, String> dependencies;
14
+    public boolean hasCoremod;
14 15
 
15 16
     public transient boolean valid;
16 17
 }

Loading…
Cancel
Save