Framework is library built to ease the development in multiloader projects.
Framework is hosted using GitHub Packages, however in order to depend on Framework, a GitHub username and personal token will need to be added into your Gradle environment. These will need to be added as properties into gradle.properties
, which is a file located in the GRADLE_USER_HOME
directory, not your project. On Windows, you can quickly navigate to the required directory by pasting %GRADLE_USER_HOME%
into a File Explorer window. Personal tokens can be generated on the token settings page once logged into a GitHub account.
Important Note
For security purposes, it is recommended to generate a new personal token with only the
read:packages
scope enabled. This will limit the token to only reading packages. An expiry is also recommended to prevent the token from working forever.
Once you have generated your token, simply append and fill in the keys gpr.user
and gpr.key
in the aforemention file.
gpr.user=<USERNAME>
gpr.key=<GITHUB_PERSONAL_TOKEN>
Finally you can add the repository and implement the dependencies
def getGprUser() {
return project.findProperty('gpr.user')
}
def getGprKey() {
return project.findProperty('gpr.key')
}
repositories {
if(getGprUser() && getGprKey()) {
maven {
name = "MrCrayfish (GitHub)"
url = "https://maven.pkg.github.com/MrCrayfish/Maven"
credentials {
username = getGprUser()
password = getGprKey()
}
}
}
}
dependencies {
// For common module (Official mappings)
implementation "com.mrcrayfish:framework-common:<minecraft_version>-<framework_version>"
// NeoForge
implementation "com.mrcrayfish:framework-neoforge:<minecraft_version>-<framework_version>"
// Fabric
modImplementation "com.mrcrayfish:framework-fabric:<minecraft_version>-<framework_version>"
}