mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Add Platform#getFilePaths (#268)
Signed-off-by: Max <maxh2709@gmail.com> (cherry picked from commit517205efdc) (cherry picked from commitd1d491dad2)
This commit is contained in:
@@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface Mod {
|
||||
@@ -45,6 +46,19 @@ public interface Mod {
|
||||
*/
|
||||
Optional<String> getLogoFile(int preferredSize);
|
||||
|
||||
/**
|
||||
* Gets a list of all possible root paths for the mod.
|
||||
* This is especially relevant on Fabric, as a single mod may have multiple source sets
|
||||
* (such as client / server-specific ones), each corresponding to one root path.
|
||||
*
|
||||
* @return A list of root paths belonging to the mod
|
||||
*/
|
||||
List<Path> getFilePaths();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getFilePaths()} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
Path getFilePath();
|
||||
|
||||
Collection<String> getAuthors();
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -116,7 +117,12 @@ public class PlatformImpl {
|
||||
public @NotNull Optional<String> getLogoFile(int preferredSize) {
|
||||
return metadata.getIconPath(preferredSize);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Path> getFilePaths() {
|
||||
return container.getRootPaths();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Path getFilePath() {
|
||||
return container.getRootPath();
|
||||
|
||||
@@ -127,7 +127,12 @@ public class PlatformImpl {
|
||||
public @NotNull Optional<String> getLogoFile(int i) {
|
||||
return this.info.getLogoFile();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Path> getFilePaths() {
|
||||
return List.of(getFilePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Path getFilePath() {
|
||||
return this.info.getOwningFile().getFile().getFilePath();
|
||||
|
||||
Reference in New Issue
Block a user