Package org.mcaccess.minecraftaccess.api


package org.mcaccess.minecraftaccess.api
This package contains the public API for Minecraft Access. Anything outside of this package or anything annotated with ApiStatus.Internal is not part of the public API, may change at any time in any way without notice, and should not be accessed.

Getting Started

1. Dependency

Minecraft Access is available on Maven Central, which should be available by default. In the below examples, VERSION should be replaced with the current version of Minecraft Access.

Currently, the artifacts published to Maven Central are not able to run Minecraft Access in a development environment. This will likely be changed in a future version. Until then, artifacts from Modrinth Maven can be used for testing.

Using a Version Catalog

gradle/libs.versions.toml
[libraries]
minecraftAccess = "org.mcaccess:minecraft-access:VERSION"

# Optional: Only needed to run Minecraft Access in the development environment
# NeoForge is also available.
minecraftAccessFabric = "maven.modrinth:minecraft-access:VERSION+fabric"
build.gradle
// Optional: Only needed to run Minecraft Access in the development environment
repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = 'Modrinth'
                url = 'https://api.modrinth.com/maven'
            }
        }
        filter {
            includeGroup 'maven.modrinth'
        }
    }
}

dependencies {
    // compileOnly should be used instead on NeoForge
    modCompileOnly libs.minecraftAccess

    // Optional: Enables Minecraft Access in the development environment
    // runtimeOnly should be used instead on NeoForge
    modRuntimeOnly libs.minecraftAccessFabric
}

Without a Version Catalog

build.gradle
// Optional: Only needed to run Minecraft Access in the development environment
repositories {
    exclusiveContent {
        forRepository {
            maven {
                name = 'Modrinth'
                url = 'https://api.modrinth.com/maven'
            }
        }
        filter {
            includeGroup 'maven.modrinth'
        }
    }
}

dependencies {
    // compileOnly should be used instead on NeoForge
    modCompileOnly 'org.mcaccess:minecraft-access:VERSION'

    // Optional: Enables Minecraft Access in the development environment
    // runtimeOnly should be used instead on NeoForge
    modRuntimeOnly 'maven.modrinth:minecraft-access:VERSION+fabric'
}

2. Creating an Addon

To interact with the API, an MinecraftAccessAddon must be created. See AddonRegistry for what can be registered.

src/main/java/com/example/MyAddon.java

public class MyAddon implements MinecraftAccessAddon {
    @Override
    public void init(AddonRegistry registry) {
        // ...
    }
}

3. Addon Registration

Addons must be registered either by adding it to fabric.mod.json on Fabric or by annotating it with MinecraftAccessAddon.NeoForge on NeoForge.

src/main/resources/fabric.mod.json

{
    "entrypoints": {
        "minecraft_access": [
            "com.example.MyAddon"
        ]
    }
}

NeoForge

@MinecraftAccessAddon.NeoForge
public class MyAddon implements MinecraftAccessAddon {
    // ...
}
Since:
1.12.0
See Also: