Skip to content

Projects

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");

You can access project metadata directly:

String title = project.title;
String description = project.description;
long downloads = project.downloads;

The available fields depend on whether the project was returned by a search endpoint or a detail endpoint.

Project FieldsProject metadata
idDetail

The unique Modrinth project ID returned by the detail endpoint.

Type: String
projectIdSearch

The unique Modrinth project ID returned by the search endpoint.

Type: String
slug

The human-readable identifier of the project.

Type: String
title

The display name of the project.

Type: String
description

A short description of the project.

Type: String
bodyDetail

The full project description.

Type: String
projectType

The type of content provided by the project.

Type: ProjectType
monetizationStatus

The monetization status of the project.

Type: String
author

The display name of the project author.

Type: String
authorId

The unique ID of the project author.

Type: String
organization

The organization that owns the project, if available.

Type: String
team

The ID of the team associated with the project.

Type: String
clientSide

Describes the project’s client-side support.

Type: SideSupport
serverSide

Describes the project’s server-side support.

Type: SideSupport
categories

The categories and tags assigned to the project.

Type: String[]
gameVersions

The Minecraft versions supported by the project.

Type: String[]
loaders

The mod loaders and platforms supported by the project.

Type: String[]
downloads

The total number of project downloads.

Type: long
followsSearch

The number of project followers returned by the search endpoint.

Type: long
followersDetail

The number of project followers returned by the detail endpoint.

Type: long
iconUrl

The URL of the project’s icon.

Type: String
color

The project’s display color.

Type: Integer
license

License information for the project.

Type: ProjectLicense
gallery

The images available in the project’s gallery.

Type: GalleryImage[]
published

The time at which the project was published.

Type: Instant
updated

The time at which the project was last updated.

Type: Instant

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.

Returns: String[]
hasTag()

Checks whether the project contains a specific tag.

Returns: boolean
hasDisplayTag()

Checks whether the project contains a specific display tag.

Returns: boolean
hasAdditionalTag()

Checks whether the project contains a specific additional tag.

Returns: boolean
hasLoader()

Checks whether the project supports a loader.

Accepts: String or ModLoader

supportsVersion()

Checks whether the project supports a Minecraft version.

Returns: boolean
getFeaturedGallery()

Returns the featured gallery image, if one exists.

Returns: GalleryImage
getLatestVersion()

Resolves the latest matching version of the project.

Returns: Version
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
}
boolean optimization = project.hasTag("optimization");
boolean technology = project.hasDisplayTag("technology");

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);
}

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.

Version latest = project.getLatestVersion(
"1.21.11",
ModLoader.FABRIC
);

For more control, pass a VersionSearchOptions object:

VersionSearchOptions options = VersionSearchOptions.builder()
.gameVersions("1.21.11")
.loaders("fabric")
.build();
Version latest = project.getLatestVersion(options);