Update SJH to 2.0.2.. (#8774)

* Update SJH to 2.0.3..
This commit is contained in:
cpw authored and GitHub committed 2022-06-20 16:11:13 -04:00
1 parent 4b813e4319
commit ca90babc4a
5 files changed
+15 -16

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ ext {
COREMODS_VERSION = '5.0.1'
EVENTBUS_VERSION = '6.0.0'
MODLAUNCHER_VERSION = '10.0.1'
SECUREJARHANDLER_VERSION = '1.0.5'
SECUREJARHANDLER_VERSION = '2.0.3'
BOOTSTRAPLAUNCHER_VERSION = '1.1.0'
ASM_VERSION = '9.3'
INSTALLER_VERSION = '2.1.+'
@@ -162,7 +162,8 @@ public class ModSorter
modFiles.stream()
.filter(modFile -> modFile.getProvider().getClass() == MinecraftLocator.class)
.map(ModFile::getSecureJar)
.map(SecureJar::getManifest)
.map(SecureJar::moduleDataProvider)
.map(SecureJar.ModuleDataProvider::getManifest)
.map(Manifest::getMainAttributes)
.map(mf -> mf.getValue("FML-System-Mods"))
.filter(Objects::nonNull)
@@ -37,26 +37,24 @@ public abstract class AbstractModProvider implements IModProvider
var mjm = new ModJarMetadata();
var sj = SecureJar.from(
Manifest::new,
jar -> jar.findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
jar -> jar.moduleDataProvider().findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
(root, p) -> true,
path
);
IModFile mod;
var type = sj.getManifest().getMainAttributes().getValue(ModFile.TYPE);
var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE);
if (type == null) {
type = getDefaultJarModType();
}
try {
if (sj.findFile(MODS_TOML).isPresent()) {
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
mod = new ModFile(sj, this, ModFileParser::modsTomlParser);
} else if (type != null) {
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
mod = new ModFile(sj, this, this::manifestParser, type);
if (sj.moduleDataProvider().findFile(MODS_TOML).isPresent()) {
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
mod = new ModFile(sj, this, ModFileParser::modsTomlParser);
} else if (type != null) {
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
mod = new ModFile(sj, this, this::manifestParser, type);
} else {
return new IModLocator.ModFileOrException(null, new ModFileLoadingException("Invalid mod file found "+ Arrays.toString(path)));
}
} catch (InvalidModFileException e) {
return new IModLocator.ModFileOrException(null, e);
}
@@ -66,7 +64,7 @@ public abstract class AbstractModProvider implements IModProvider
}
protected IModFileInfo manifestParser(final IModFile mod) {
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().getManifest().getMainAttributes().getValue(name));
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().moduleDataProvider().getManifest().getMainAttributes().getValue(name));
var license = cfg.apply("LICENSE").orElse("");
var dummy = new IConfigurable() {
@Override
@@ -33,7 +33,7 @@ public class ExplodedDirectoryLocator implements IModLocator {
public List<IModLocator.ModFileOrException> scanMods() {
explodedMods.forEach(explodedMod ->
ModJarMetadata.buildFile(this,
jar->jar.findFile("/META-INF/mods.toml").isPresent(),
jar->jar.moduleDataProvider().findFile("/META-INF/mods.toml").isPresent(),
(a,b) -> true,
explodedMod.paths().toArray(Path[]::new))
.ifPresentOrElse(f->mods.put(explodedMod, f), () -> LOGGER.warn(LogMarkers.LOADING, "Failed to find exploded resource mods.toml in directory {}", explodedMod.paths().get(0).toString())));
@@ -73,7 +73,7 @@ public class ModFile implements IModFile {
this.jar = jar;
this.parser = parser;
manifest = this.jar.getManifest();
manifest = this.jar.moduleDataProvider().getManifest();
modFileType = Type.valueOf(type);
jarVersion = Optional.ofNullable(manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION)).orElse("0.0NONE");
this.modFileInfo = ModFileParser.readModList(this, this.parser);
@@ -214,7 +214,7 @@ public class ModFile implements IModFile {
}
private static String parseType(final SecureJar jar) {
final Manifest m = jar.getManifest();
final Manifest m = jar.moduleDataProvider().getManifest();
final Optional<String> value = Optional.ofNullable(m.getMainAttributes().getValue(TYPE));
return value.orElse("MOD");
}