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.
bodyUrlLegacy field, always null according to the Modrinth API.
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.
organizationIdThe unique ID of the 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.
environmentReplaces clientSide/serverSide as the preferred way to describe where the project runs. Both are still populated, but prefer this field going forward.
categoriesThe categories and tags assigned to the project.
displayCategoriesThe subset of categories shown on the project’s search card.
additionalCategoriesCategories assigned to the project that aren’t primary categories.
versionsThe IDs of every version published under the project.
gameVersionsThe Minecraft versions supported by the project.
loadersThe mod loaders and platforms supported by the project.
disclosureTypesSearchContent disclosure categories (AI content, telemetry, advertisements, and so on) the project is tagged with, returned by the search endpoint only.
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.
rawIconUrlDetailThe unoptimized icon, returned by the detail endpoint only.
colorThe project’s display color.
threadIdThe ID of the moderation thread associated with the project.
issuesUrlThe URL of the project’s issue tracker, if any.
sourceUrlThe URL of the project’s source code repository, if any.
wikiUrlThe URL of the project’s wiki page, if any.
discordUrlThe invite URL of the project’s Discord server, if any.
donationUrlsThe donation platforms and links listed for the project.
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.
getDisplayTags()Returns the subset of tags shown on the project’s search card.
getAdditionalTags()Returns tags assigned to the project that aren’t primary categories.
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.
supportsEnvironment()Checks whether the project supports a specific Environment value.
hasDisclosure()Checks whether the project is tagged with a specific DisclosureType.
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")Checking Environment and Disclosures
Section titled “Checking Environment and Disclosures”boolean clientOnly = project.supportsEnvironment(Environment.CLIENT_ONLY);boolean usesTelemetry = project.hasDisclosure(DisclosureType.TELEMETRY);val clientOnly = project.supportsEnvironment(Environment.CLIENT_ONLY)val usesTelemetry = project.hasDisclosure(DisclosureType.TELEMETRY)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)