mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
65 lines
1.9 KiB
Groovy
65 lines
1.9 KiB
Groovy
// This is a minimal setup of a Forge mod workspace.
|
|
// For complex examples (including AccessTransformers, Jar-in-Jar, and Mixin), see our examples repository.
|
|
// https://github.com/MinecraftForge/MDKExamples
|
|
|
|
plugins {
|
|
id 'java'
|
|
id 'idea'
|
|
id 'eclipse'
|
|
id 'net.minecraftforge.gradle' version '[7.0.3,8)'
|
|
}
|
|
|
|
version = '1.0.0'
|
|
group = 'com.example.examplemod'
|
|
|
|
// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
|
|
|
// Include generated resources
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
|
|
minecraft {
|
|
mappings channel: 'official', version: '@MC_VERSION@'
|
|
|
|
runs {
|
|
configureEach {
|
|
workingDir = layout.projectDirectory.dir('run')
|
|
|
|
systemProperty 'eventbus.api.strictRuntimeChecks', 'true'
|
|
systemProperty 'forge.enabledGameTestNamespaces', 'examplemod'
|
|
}
|
|
|
|
register('client')
|
|
|
|
register('server') {
|
|
args '--nogui'
|
|
}
|
|
|
|
register('gameTestServer')
|
|
|
|
register('data') {
|
|
workingDir = layout.projectDirectory.dir('run-data')
|
|
|
|
args '--mod', 'examplemod', '--all', '--output', layout.projectDirectory.dir('src/generated/resources'), '--existing', layout.projectDirectory.dir('src/main/resources')
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
minecraft.mavenizer(it) // In Kotlin, it = this
|
|
maven fg.forgeMaven
|
|
maven fg.minecraftLibsMaven
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation minecraft.dependency('net.minecraftforge:forge:@MC_VERSION@-@FORGE_VERSION@')
|
|
annotationProcessor 'net.minecraftforge:eventbus-validator:@EVENTBUS_VERSION@'
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
// Use the UTF-8 charset for Java compilation
|
|
// This is done by default in Java 18+, but this ensures it no matter the Java or Gradle version
|
|
options.encoding = 'UTF-8'
|
|
}
|