-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
To be able to work with manifests, you first have to instantiate a repository containing them. In the API, you can do this via the ManifestRepository
class and its implementation:
ManifestRepository repo
= new ManifestRepositoryImpl(0, "https://raw.githubusercontent.com/ReviversMC/modget-manifests");
As you can see, each ManifestRepositoryImpl
has to have an ID (should be unique) and a URL leading to the parent folder of your repository.
It's mandatory for each Modget manifest repository to have a lookup table in its root directory. You can download it via the LookupTableDownloader
class:
LookupTable lookuptable = LookupTableDownloader.create().downloadLookupTable(repo);
Although it's easier to call
LookupTable lookuptable = repo.getOrDownloadLookupTable();
This method downloads the lookup table if not already done, and returns the downloaded one otherwise.
Once you have the lookup table, you can already do basic workflows like searching for mods. Each lookup table is comprised of multiple LookupTableEntries
, which contain basic metadata like the mod's id
, alternativeNames
, the associated tags
and a list of available packages
.
So if you want to search for mods matching a specific criteria, you can do it like this:
String searchTerm = "fabric";
List<LookupTableEntry> foundEntries = new ArrayList<>();
for (LookupTableEntry entry : lookupTable.getEntries()) {
if (entry.getId().toLowerCase().contains(searchTearm.toLowerCase())) {
foundEntries.add(entry);
}
else if (entry.getAlternativeNames.contains(searchTerm)) {
foundEntries.add(entry);
}
else if (entry.getTags.contains(searchTerm)) {
foundEntries.add(entry);
}
}