Skip to content

Commit

Permalink
Include required Fabric API modules into the compiled jar
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbot16 committed Dec 31, 2020
1 parent 0dc452a commit 83c3ad0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
21 changes: 18 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation(fabricApi.module('fabric-resource-loader-v0', project.fabric_version))
modImplementation(fabricApi.module('fabric-key-binding-api-v1', project.fabric_version))
modImplementation(fabricApi.module('fabric-lifecycle-events-v1', project.fabric_version))
// Critical, needed for loading our custom language files
includeFabricApiModule "fabric-resource-loader-v0"

// Needed for adding the reload keybinding
includeFabricApiModule "fabric-key-binding-api-v1"

// Needed for the END_CLIENT_TICK event
includeFabricApiModule "fabric-lifecycle-events-v1"

// Required by fabric-lifecycle-events-v1
includeFabricApiModule "fabric-api-base"
}

def includeFabricApiModule(String moduleName) {
Object dependency = fabricApi.module(moduleName, project.fabric_version);

dependencies.modImplementation(dependency);
dependencies.include(dependency);
}

processResources {
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

"depends": {
"fabricloader": ">=0.7.4",
"minecraft": "1.16.x"
"minecraft": "1.16.x",
"fabric-resource-loader-v0": ">=0.3.2",
"fabric-key-binding-api-v1": ">=1.0.1",
"fabric-lifecycle-events-v1": ">=1.2.0"
}
}

0 comments on commit 83c3ad0

Please sign in to comment.