Start
Adding Dependencies
Adding via Modrinth Maven
Add the Modrinth Maven repository:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = uri("https://api.modrinth.com/maven")
}
}
filter {
includeGroup("maven.modrinth")
}
}
}Coordinate format: maven.modrinth:perspective_api:$perspectiveApiVersion+${loader}-$mcVersion.
You can also specify the project ID: maven.modrinth:LIqveQm1:$perspectiveApiVersion+${loader}-$mcVersion.
dependencies {
// Use implementation for Minecraft 26.1 and above
implementation("maven.modrinth:perspective_api:${perspectiveApiVersion}+fabric-26.2")
}INFO
You can view all versions of this mod on the Modrinth Versions or Github Releases page.
Adding com.google.auto.service Dependency (Optional)
dependencies {
compileOnly("com.google.auto.service:auto-service-annotations:1.1.1")
annotationProcessor("com.google.auto.service:auto-service:1.1.1")
}It automatically generates Java SPI service files for PerspectiveBehavior, eliminating the need to manually maintain META-INF/services.
Next steps
- Custom Perspective: Define a complete camera mode
- Projection Mode: Render the world in perspective or orthographic projection
- Perspective Modifier: Overlay camera effects on any perspective
- Override Chain: Temporarily force a perspective switch based on game state
- Migration Guide: Migrate from vanilla camera injection or early beta API versions
Perspective API consistently exposes position, rotation, and projection parameters via a unified PerspectiveState. Developers do not need to choose different callbacks for different Minecraft versions, nor should they call vanilla FOV or projection matrix calculation methods directly.
Continuous state transitions between perspectives are controlled by PerspectiveAPI.getTransition(). It provides global transition-duration and easing-function settings; position, rotation, FOV, and orthographic view height share one time progression, while projection mode switches discretely. This is an experimental API.
Example Mod
The Perspective API Demo implements multiple custom perspectives and modifiers. Its source code can serve as a development reference.