Don't crash in dev
@@ -4,7 +4,6 @@ import net.minecraftforge.fml.loading.moddiscovery.AbstractJarFileLocator;
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
import net.minecraftforge.forgespi.locating.IModFile;
-import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -17,11 +16,14 @@ public class ForgehaxModLocator extends AbstractJarFileLocator {
@Override
public List<IModFile> scanMods() {
- final Path p = EZ.getJarPath().orElseThrow(() -> new IllegalStateException("Found the modlocator but cant get path again??"));
+ return EZ.getJarPath()
+ .map(p -> {
final ModFile modFile = new ModFile(p, this);
this.modJars.compute(modFile, (mf, fs) -> this.createFileSystem(mf));
- return Collections.singletonList(modFile);
+ return Collections.singletonList((IModFile) modFile);
+ })
+ .orElse(Collections.emptyList());
}
@Override
@@ -30,7 +32,8 @@ public class ForgehaxModLocator extends AbstractJarFileLocator {
}
@Override
- public void initArguments(Map<String, ?> arguments) { }
+ public void initArguments(Map<String, ?> arguments) {
+ }
}
