Skip to content

Latest commit

 

History

History
180 lines (131 loc) · 4.79 KB

USAGE.md

File metadata and controls

180 lines (131 loc) · 4.79 KB

Usage

Unimined is a per-source-set minecraft plugin for gradle. To add the plugin to gradle, add the following to settings.gradle:

Setup

pluginManagement {
    repositories {
        maven {
            url = uri("https://maven.wagyourtail.xyz/releases")
        }
        maven {
            url = uri("https://maven.wagyourtail.xyz/snapshots")
        }
        mavenCentral() // highly recommended, but not required
        gradlePluginPortal {
            content {
                // this is not required either, unless jcenter goes down again, then it might fix things
                excludeGroup("org.apache.logging.log4j")
            }
        }
    }
}

and the following to build.gradle:

plugins {
    id 'xyz.wagyourtail.unimined' version '1.2.6'
}

this will not actually add minecraft to your project as it must be configured.

Adding Minecraft

to add minecraft to the main sourceSet, add the following:

unimined.minecraft {
    version project.minecraftVersion
    // default value
    side "combined" 
    
    mappings {
        mojmap()
    }
    
    fabric {
        loader project.fabricLoaderVersion
    }
}

for more details about what's available within the unimined.minecraft block, see The Api Source or look below.

Mappings

Mappings provide the ability to remap minecraft into names you can actually use at runtime. there are many mappings supported, see Mappings for more details.

Modloaders

Unimined supports many modloaders, see Modloaders for more details.

Standard Libraries

Unimined provides helper functions for adding common standard libraries, such as fabric-api.

dependencies {
    modImplementation fabricApi.fabricModule("fabric-api-base", project.fabricApiVersion)
}

This is under fabricApi, even for other libraries for legacy reasons, and because I haven't thought of a better name.

for a complete list of standard libraries supported, see FabricLikeApi

Remapping Mods

Unimined provides the ability to remap mods you depend on to the mappings you are using. by default, unimined only implements modImplementation, but the others are easily creatable by the user.

For Example:

configurations {
    modCompileOnly
    compileOnly.extendsFrom modCompileOnly
}

unimined.minecraft {
    ...
    mods {
        remap(configurations.modCompileOnly) {
        }
        
        // this is basically just a shortcut for `remap(configurations.modImplementation)`
        modImplementation {
            // you can do this is mods have the wrong access widener mapping, but it may break runs
            catchAWNamespaceAssertion()
        }
    }
}

dependencies {
    modCompileOnly "mod.group:mod.artifact:mod.version"
}

Remapping Output

unimined provides a default remapJar task for each configuration, it may be useful to create an extra or custom remap task

unimined.minecraft {
    ...
    defaultRemapJar = false // disable the default remapJar task
    
    remap(myJarTask) {
        prodNamespace("intermediary") // set the namespace to remap to
        mixinRemap {
            disableRefmap() // like fabric-loom 1.6
        }
    }
}

Run Configurations

unimined provides a runServer and runClient task for each sourceSet by default.

you can configure/disable these as follows:

unimined.minecraft {
    ...
    runs {
        off = true // disable all run configurations
        config("client") {
           disabled = true // disable the runClient task
           args += "--my-arg" // add an argument to the runClient task
        }
    }
}

for more details on what can be changed in the run configurations, see RunConfig

Auth

unimined provides a way to authenticate in your run configs. the recommended way is to use gradle properties/env vars.

unimined.auth.enabled=true
unimined.auth.username=myUsername

This will open a web-browser to prompt for login when configuring and the token isn't cached.

Authentication is backed by the MinecraftAuth library.

Auth is also accessible under runs.auth. for more information, see AuthConfig or it's implementation AuthProvider

Multi-SourceSet/Project

unimined can be configured seperately for each sourceSet, or in some more complicated cases. for more details with complicated setups/multiple sourceSets: see Multi-Sourceset/Project