Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ for legacy Minecraft versions (1.20.4 and older). Should *not* be done on newer
at compile-time alongside Mixin to handle runtime.
- [Mixins w/ obfuscation]: demonstrates how to configure Forge's Renamer plugin to get Mixin working on obfuscated versions.
- [Traditional MDK]: the "fat" MDK from the ForgeGradle 6- era, mainly intended as a reference to help migrate from FG6 to FG7.
- [Non Minecraft Dependency]: Demonstrates how to add a non-minecraft related dependency to the dev time classpath

[AccessTransformers-only]: https://github.com/MinecraftForge/MDKExamples/tree/master/accesstransformers-only
[JarJar-only]: https://github.com/MinecraftForge/MDKExamples/tree/master/jarjar-only
Expand All @@ -28,6 +29,7 @@ at compile-time alongside Mixin to handle runtime.
[Mixins w/ Facade interface injection]: https://github.com/MinecraftForge/MDKExamples/tree/master/mixins-facade-interface-injection
[Mixins w/ obfuscation]: https://github.com/MinecraftForge/MDKExamples/tree/master/mixins-obfuscation
[Traditional MDK]: https://github.com/MinecraftForge/MDKExamples/tree/master/traditional-mdk
[Non Minecraft Dependency]: https://github.com/MinecraftForge/MDKExamples/tree/master/non-minecraft-dependency

[GradleUp Shadow]: https://plugins.gradle.org/plugin/com.gradleup.shadow
[Renamer]: https://github.com/MinecraftForge/Renamer
Expand Down
60 changes: 60 additions & 0 deletions non-minecraft-dependency/fg7/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
id 'java'
id 'idea'
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[7.0.29,8.0)'
id 'net.minecraftforge.jarjar' version '0.2.3'
}

version = '1.0'
group = 'net.minecraftforge'
base.archivesName = mod_id

java.toolchain.languageVersion = JavaLanguageVersion.of(25)

minecraft {
runs.register('client')
}

repositories {
minecraft.mavenizer(it)
maven fg.forgeMaven
maven fg.minecraftLibsMaven
mavenCentral()
}

// Creates the jarJar configuration.
// This creates the 'jarJar' task, which by default has a classifier of 'all', with a base of the 'jar' task
// For more info see https://github.com/MinecraftForge/JarJar/blob/main/jarjar-gradle/src/main/java/net/minecraftforge/jarjar/gradle/JarJarExtension.java
jarJar.register()

// If you want to have your "normal" jar the 'all' jar, you can change the classifier using normal gradle configuration
tasks.named('jar') {
archiveClassifier = 'slim'
}
tasks.named('jarJar') {
archiveClassifier = null
}

configurations {
myNonMcConfigurationName // This name can be whatever you want, it's just so we can use it later.
}

dependencies {
// Mark this as a part of the configuration.
myNonMcConfigurationName 'org.apache.maven:maven-artifact:3.9.11'

implementation minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version")

// This adds the declared configuration jars to the classpath for dev time. This has no impact on production jars.
// Note, this is a workaround as FG7 does not have an equivalent to FG6's minecraftLibrary at the time of writing.
// todo update this when this is officially exposed.
minecraft.dependency.asProvider().get().__fg_minecraft_dependency.minecraftDependencies.dependencies.addAll(configurations.myNonMcConfigurationName.dependencies)

// If you are using a non-minecraft related dependency, it is highly likely you will need to JarJar said dependency.
// so that production jars will work as expected.
implementation 'org.apache.maven:maven-artifact:3.9.11' // Presumably you will also be dev against it.
jarJar('org.apache.maven:maven-artifact:3.9.11')

}
15 changes: 15 additions & 0 deletions non-minecraft-dependency/fg7/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true

org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.problems=warn

net.minecraftforge.gradle.merge-source-sets=true

## Environment Properties

minecraft_version=26.2
forge_version=65.0.0
mod_id=examplemod
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
248 changes: 248 additions & 0 deletions non-minecraft-dependency/fg7/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading