Skip to content

Commit

Permalink
Merge pull request #1560 from jjtParadox/mods-slash-1.7.10-fix
Browse files Browse the repository at this point in the history
Fixed preloader not finding mods in mods/1.7.10 folder
  • Loading branch information
Mithion authored Jul 31, 2017
2 parents d9b3749 + 3b65b9b commit 528c68b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/am2/preloader/AM2PreloaderContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

Expand Down Expand Up @@ -83,6 +84,11 @@ public String getSetupClass(){

@Override
public void injectData(Map<String, Object> data){
if (((String)data.get("coremodList")).contains("DragonAPIASMHandler")){

This comment has been minimized.

Copy link
@chaos234

chaos234 Feb 20, 2018

After a compile with this if-statement the client/launcher will not start because of:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at am2.preloader.AM2PreloaderContainer.injectData(AM2PreloaderContainer.java:87) ~[AM2-1.4.0.009.jar:?]

Commenting those lines out let it continue loading. This should be checked against -source: 1.7

LogHelper.info("Core: Located DragonAPI in list of coremods");
foundDragonAPI = true;
}

// This is very crude check for mods presence using filename.
// Some mods may refer to others in their name, so we'll to confirm those assumption with class presence check.
File loc = (File)data.get("mcLocation");
Expand All @@ -91,7 +97,14 @@ public void injectData(Map<String, Object> data){
isDevEnvironment = !(Boolean)data.get("runtimeDeobfuscationEnabled");

File mcFolder = new File(loc.getAbsolutePath() + File.separatorChar + "mods");
File[] subfiles = mcFolder.listFiles();
File mcVersionFolder = new File(mcFolder.getAbsolutePath() + File.separatorChar + "1.7.10");
ArrayList<File> subfiles = new ArrayList<>();
if (mcFolder.listFiles() != null){
subfiles = new ArrayList<>(Arrays.asList(mcFolder.listFiles()));
if (mcVersionFolder.listFiles() != null){
subfiles.addAll(Arrays.asList(mcVersionFolder.listFiles()));
}
}
for (File file : subfiles){
String name = file.getName();
if (name != null) {
Expand Down

0 comments on commit 528c68b

Please sign in to comment.