Skip to content

Commit

Permalink
A few defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Jan 13, 2024
1 parent 32dc3f0 commit c1da022
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions spi/src/main/java/net/neoforged/neoforgespi/locating/IModFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
import net.neoforged.neoforgespi.language.IModLanguageProvider;
import net.neoforged.neoforgespi.language.ModFileScanData;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.jetbrains.annotations.ApiStatus;

import java.lang.module.ModuleDescriptor;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -122,17 +124,23 @@ public interface IModFile {
/**
* {@return the coremods contained in this file}
*/
List<ICoreModFile> getCoreMods();
default List<ICoreModFile> getCoreMods() {
return List.of();
}

/**
* {@return the names of the Mixin configs of this file}
*/
List<String> getMixinConfigs();
default List<String> getMixinConfigs() {
return List.of();
}

/**
* {@return the paths to the access transformer files contained in this file}
*/
List<Path> getAccessTransformers();
default List<Path> getAccessTransformers() {
return List.of();
}

/**
* {@return the controller of this file}
Expand All @@ -147,7 +155,9 @@ public interface IModFile {
* Usually this is the version in the jar's manifest.
* @apiNote This version may not be accurate, when possible, use the version of the mods contained in the file.
*/
ArtifactVersion getVersion();
default ArtifactVersion getVersion() {
return new DefaultArtifactVersion(getSecureJar().moduleDataProvider().descriptor().version().map(ModuleDescriptor.Version::toString).orElse("0.0NONE"));
}

/**
* The type of file.
Expand Down

0 comments on commit c1da022

Please sign in to comment.