Projects
1. The Project Object
Section titled “1. The Project Object”The Project class represents a project returned by the Modrinth API.
A project can contain metadata such as its title, description, supported Minecraft versions, loaders, download count, gallery images, links, and more.
Project project = modrinth.projects().get("sodium");val project = modrinth.projects().get("sodium")You can access project metadata directly:
String title = project.title;String description = project.description;long downloads = project.downloads;val title = project.titleval description = project.descriptionval downloads = project.downloads2. Fields
Section titled “2. Fields”The available fields depend on whether the project was returned by a search endpoint or a detail endpoint.
Project FieldsProject metadata
idDetailThe unique Modrinth project ID returned by the detail endpoint.
projectIdSearchThe unique Modrinth project ID returned by the search endpoint.
slugThe human-readable identifier of the project.
titleThe display name of the project.
descriptionA short description of the project.
bodyDetailThe full project description.
projectTypeThe type of content provided by the project.
monetizationStatusThe monetization status of the project.
authorThe display name of the project author.
authorIdThe unique ID of the project author.
organizationThe organization that owns the project, if available.
teamThe ID of the team associated with the project.
clientSideDescribes the project’s client-side support.
serverSideDescribes the project’s server-side support.
categoriesThe categories and tags assigned to the project.
gameVersionsThe Minecraft versions supported by the project.
loadersThe mod loaders and platforms supported by the project.
downloadsThe total number of project downloads.
followsSearchThe number of project followers returned by the search endpoint.
followersDetailThe number of project followers returned by the detail endpoint.
iconUrlThe URL of the project’s icon.
colorThe project’s display color.
licenseLicense information for the project.
galleryThe images available in the project’s gallery.
publishedThe time at which the project was published.
updatedThe time at which the project was last updated.
3. Convenience Methods
Section titled “3. Convenience Methods”The Project class provides convenience methods for common project checks and metadata access.
Project MethodsMetadata and compatibility helpers
getTags()Returns the project’s categories as tags.
hasTag()Checks whether the project contains a specific tag.
hasDisplayTag()Checks whether the project contains a specific display tag.
hasAdditionalTag()Checks whether the project contains a specific additional tag.
hasLoader()Checks whether the project supports a loader.
supportsVersion()Checks whether the project supports a Minecraft version.
getFeaturedGallery()Returns the featured gallery image, if one exists.
getLatestVersion()Resolves the latest matching version of the project.
Checking Compatibility
Section titled “Checking Compatibility”boolean supportsFabric = project.hasLoader(ModLoader.FABRIC);boolean supportsVersion = project.supportsVersion("1.21.11");
if (supportsFabric && supportsVersion) { // The project supports Fabric on Minecraft 1.21.11}val supportsFabric = project.hasLoader(ModLoader.FABRIC)val supportsVersion = project.supportsVersion("1.21.11")
if (supportsFabric && supportsVersion) { // The project supports Fabric on Minecraft 1.21.11}Working with Tags
Section titled “Working with Tags”boolean optimization = project.hasTag("optimization");boolean technology = project.hasDisplayTag("technology");val optimization = project.hasTag("optimization")val technology = project.hasDisplayTag("technology")Getting the Featured Gallery Image
Section titled “Getting the Featured Gallery Image”getFeaturedGallery() returns the gallery image marked as featured, or null if the project has no featured image.
GalleryImage featured = project.getFeaturedGallery();
if (featured != null) { System.out.println(featured.url);}val featured = project.getFeaturedGallery()
if (featured != null) { println(featured.url)}4. Resolving the Latest Version
Section titled “4. Resolving the Latest Version”A project returned by a Modrinth client is automatically attached to that client. This allows you to resolve the latest matching version directly from the project.
By Game Version and Loader
Section titled “By Game Version and Loader”Version latest = project.getLatestVersion( "1.21.11", ModLoader.FABRIC);val latest = project.getLatestVersion( "1.21.11", ModLoader.FABRIC)With Version Search Options
Section titled “With Version Search Options”For more control, pass a VersionSearchOptions object:
VersionSearchOptions options = VersionSearchOptions.builder() .gameVersions("1.21.11") .loaders("fabric") .build();
Version latest = project.getLatestVersion(options);val options = VersionSearchOptions.builder() .gameVersions("1.21.11") .loaders("fabric") .build()
val latest = project.getLatestVersion(options)