Switch to neoforge and neogradle
This commit is contained in:
parent
91835905a3
commit
9b7e424fc5
120
build.gradle.kts
120
build.gradle.kts
@ -4,6 +4,7 @@ import java.util.Date
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream
|
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream
|
||||||
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
val mod_version: String by project
|
val mod_version: String by project
|
||||||
val mc_version: String by project
|
val mc_version: String by project
|
||||||
@ -16,9 +17,10 @@ val handleDeps = handle_deps.toBoolean()
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
kotlin
|
kotlin
|
||||||
|
idea
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("net.minecraftforge.gradle")
|
id("net.neoforged.gradle.userdev")
|
||||||
id("org.spongepowered.mixin")
|
id("net.neoforged.gradle.mixin")
|
||||||
}
|
}
|
||||||
|
|
||||||
data class GitInfo(val version: String, val tag: String, val buildNumber: String) {
|
data class GitInfo(val version: String, val tag: String, val buildNumber: String) {
|
||||||
@ -94,9 +96,9 @@ java.toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
|||||||
println("Targeting Java ${java.toolchain.languageVersion.get()}")
|
println("Targeting Java ${java.toolchain.languageVersion.get()}")
|
||||||
|
|
||||||
tasks.withType(KotlinCompile::class.java) {
|
tasks.withType(KotlinCompile::class.java) {
|
||||||
kotlinOptions {
|
compilerOptions {
|
||||||
freeCompilerArgs = listOf("-Xjvm-default=all")
|
freeCompilerArgs = listOf("-Xjvm-default=all")
|
||||||
jvmTarget = java.toolchain.languageVersion.get().toString()
|
jvmTarget.set(JvmTarget.JVM_21)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +134,7 @@ dependencies {
|
|||||||
val mixin_version: String by project
|
val mixin_version: String by project
|
||||||
val kommons_version: String by project
|
val kommons_version: String by project
|
||||||
|
|
||||||
minecraft("net.minecraftforge:forge:$mc_version-$forge_version")
|
implementation("net.neoforged:neoforge:$forge_version")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:${jupiter_version}")
|
testImplementation("org.junit.jupiter:junit-jupiter:${jupiter_version}")
|
||||||
|
|
||||||
implementation("thedarkcolour:kotlinforforge:$kotlin_for_forge_version")
|
implementation("thedarkcolour:kotlinforforge:$kotlin_for_forge_version")
|
||||||
@ -157,33 +159,33 @@ dependencies {
|
|||||||
val ad_astra_id: String by project
|
val ad_astra_id: String by project
|
||||||
val worldedit_id: String by project
|
val worldedit_id: String by project
|
||||||
|
|
||||||
compileOnly(("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_mc_version}"))
|
compileOnly("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_mc_version}")
|
||||||
compileOnly(("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id"))
|
compileOnly("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id")
|
||||||
|
|
||||||
compileOnly(("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"))
|
compileOnly("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}")
|
||||||
compileOnly(("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}"))
|
compileOnly("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}")
|
||||||
runtimeOnly(("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}"))
|
runtimeOnly("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}")
|
||||||
|
|
||||||
// runtimeOnly(("ru.dbotthepony:particle-collider:0.4.5"))
|
// runtimeOnly("ru.dbotthepony:particle-collider:0.4.5")
|
||||||
|
|
||||||
implementation(("curse.maven:jade-324717:${jade_id}"))
|
implementation("curse.maven:jade-324717:${jade_id}")
|
||||||
//runtimeOnly(("curse.maven:configured-457570:${configured_id}"))
|
//runtimeOnly("curse.maven:configured-457570:${configured_id}")
|
||||||
|
|
||||||
compileOnly(("curse.maven:resourceful-lib-570073:${resourceful_lib_id}"))
|
compileOnly("curse.maven:resourceful-lib-570073:${resourceful_lib_id}")
|
||||||
compileOnly(("curse.maven:resourceful-config-714059:${resourceful_config_id}"))
|
compileOnly("curse.maven:resourceful-config-714059:${resourceful_config_id}")
|
||||||
compileOnly(("curse.maven:botarium-704113:${botarium_id}"))
|
compileOnly("curse.maven:botarium-704113:${botarium_id}")
|
||||||
compileOnly(("curse.maven:ad-astra-635042:${ad_astra_id}"))
|
compileOnly("curse.maven:ad-astra-635042:${ad_astra_id}")
|
||||||
runtimeOnly(("curse.maven:worldedit-225608:${worldedit_id}"))
|
runtimeOnly("curse.maven:worldedit-225608:${worldedit_id}")
|
||||||
|
|
||||||
// runtimeOnly(("curse.maven:worldedit-225608:${worldedit_fileid}"))
|
// runtimeOnly("curse.maven:worldedit-225608:${worldedit_fileid}")
|
||||||
// runtimeOnly(("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
|
// runtimeOnly("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}")
|
||||||
|
|
||||||
// runtimeOnly(("curse.maven:cyclops-core-232758:4392602"))
|
// runtimeOnly("curse.maven:cyclops-core-232758:4392602")
|
||||||
// runtimeOnly(("curse.maven:integrated-dynamics-236307:4391535"))
|
// runtimeOnly("curse.maven:integrated-dynamics-236307:4391535")
|
||||||
// runtimeOnly(("curse.maven:integrated-crafting-287357:4391487"))
|
// runtimeOnly("curse.maven:integrated-crafting-287357:4391487")
|
||||||
// runtimeOnly(("curse.maven:integrated-terminals-295910:4400924"))
|
// runtimeOnly("curse.maven:integrated-terminals-295910:4400924")
|
||||||
// runtimeOnly(("curse.maven:common-capabilities-247007:4391468"))
|
// runtimeOnly("curse.maven:common-capabilities-247007:4391468")
|
||||||
// runtimeOnly(("curse.maven:integrated-tunnels-251389:4344632"))
|
// runtimeOnly("curse.maven:integrated-tunnels-251389:4344632")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,32 +194,20 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings("official", mc_version)
|
//accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
|
||||||
|
|
||||||
copyIdeResources.set(true)
|
|
||||||
|
|
||||||
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
|
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
configureEach {
|
configureEach {
|
||||||
workingDirectory = project.file("run").absolutePath
|
|
||||||
|
|
||||||
// "SCAN": For mods scan.
|
// "SCAN": For mods scan.
|
||||||
// "REGISTRIES": For firing of registry events.
|
// "REGISTRIES": For firing of registry events.
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
property("forge.logging.markers", "REGISTRIES")
|
systemProperty("forge.logging.markers", "REGISTRIES")
|
||||||
|
|
||||||
// Log4j console level
|
// Log4j console level
|
||||||
property("forge.logging.console.level", "debug")
|
systemProperty("forge.logging.console.level", "debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
create("client") {
|
getByName("client") {
|
||||||
mods {
|
|
||||||
create(mod_id) {
|
|
||||||
source(sourceSets["main"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val usernameStream = FastByteArrayOutputStream()
|
val usernameStream = FastByteArrayOutputStream()
|
||||||
|
|
||||||
val gotUsername = exec {
|
val gotUsername = exec {
|
||||||
@ -230,39 +220,28 @@ minecraft {
|
|||||||
val originalUsername = usernameStream.array.copyOfRange(0, usernameStream.length).toString(Charsets.UTF_8).trim()
|
val originalUsername = usernameStream.array.copyOfRange(0, usernameStream.length).toString(Charsets.UTF_8).trim()
|
||||||
|
|
||||||
if (originalUsername.isNotEmpty()) {
|
if (originalUsername.isNotEmpty()) {
|
||||||
args("--username", originalUsername)
|
programArguments.addAll("--username", originalUsername)
|
||||||
} else {
|
} else {
|
||||||
args("--username", "Dev_${System.getProperty("user.name")}")
|
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
args("--username", "Dev_${System.getProperty("user.name")}")
|
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
create("server") {
|
getByName("server") {
|
||||||
mods {
|
programArguments.addAll("nogui")
|
||||||
create(mod_id) {
|
|
||||||
source(sourceSets["main"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
args("nogui")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
create("data") {
|
getByName("data") {
|
||||||
args("--mod", mod_id, "--all", "--output", file("src/data/resources/"), "--existing", file("src/main/resources/"))
|
programArguments.addAll("--mod", mod_id, "--all", "--output", file("src/data/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath)
|
||||||
|
|
||||||
mods {
|
modSources(sourceSets["main"], sourceSets["data"])
|
||||||
create(mod_id) {
|
|
||||||
sources(sourceSets["main"], sourceSets["data"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixin {
|
mixin {
|
||||||
add(sourceSets.main.get(), "$mod_id.refmap.json")
|
|
||||||
config("$mod_id.mixins.json")
|
config("$mod_id.mixins.json")
|
||||||
config("$mod_id.ad_astra.mixins.json")
|
config("$mod_id.ad_astra.mixins.json")
|
||||||
}
|
}
|
||||||
@ -287,6 +266,15 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maven(url = "https://maven.neoforged.net/releases") {
|
||||||
|
name = "Neoforge"
|
||||||
|
|
||||||
|
content {
|
||||||
|
includeGroup("net.neoforged.gradle")
|
||||||
|
includeGroup("net.neoforged")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
name = "Kotlin for Forge"
|
name = "Kotlin for Forge"
|
||||||
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
|
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
|
||||||
@ -332,10 +320,7 @@ fun org.gradle.jvm.tasks.Jar.attachManifest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example configuration to allow publishing using the maven-publish plugin
|
|
||||||
// This is the preferred method to reobfuscate your jar file
|
|
||||||
tasks.jar.configure {
|
tasks.jar.configure {
|
||||||
finalizedBy("reobfJar")
|
|
||||||
attachManifest()
|
attachManifest()
|
||||||
archiveClassifier.set("slim")
|
archiveClassifier.set("slim")
|
||||||
archiveVersion.set(gitVersion.jarName)
|
archiveVersion.set(gitVersion.jarName)
|
||||||
@ -412,3 +397,10 @@ if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") &&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
isDownloadSources = true
|
||||||
|
isDownloadJavadoc = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -14,8 +14,8 @@ mc_version=1.21
|
|||||||
jei_mc_version=1.21
|
jei_mc_version=1.21
|
||||||
curios_mc_version=1.20.2
|
curios_mc_version=1.20.2
|
||||||
|
|
||||||
forge_gradle_version=[6.0.14,6.2)
|
forge_gradle_version=[7.0.145,)
|
||||||
forge_version=51.0.18
|
forge_version=21.0.54-beta
|
||||||
mixingradle_version=0.7.33
|
mixingradle_version=0.7.33
|
||||||
mixin_version=0.8.5
|
mixin_version=0.8.5
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ println("Running with Java ${System.getProperty("java.version")} on JVM: ${Syste
|
|||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
maven(url = "https://maven.neoforged.net/releases")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,12 +15,12 @@ plugins {
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
|
||||||
maven(url = "https://maven.minecraftforge.net") {
|
maven(url = "https://maven.neoforged.net/releases") {
|
||||||
name = "Minecraft Forge"
|
name = "Neoforge"
|
||||||
|
|
||||||
content {
|
content {
|
||||||
includeGroup("net.minecraftforge.gradle")
|
includeGroup("net.neoforged.gradle")
|
||||||
includeGroup("net.minecraftforge")
|
includeGroup("net.neoforged")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +40,8 @@ buildscript {
|
|||||||
val forge_gradle_version: String by settings
|
val forge_gradle_version: String by settings
|
||||||
val mixingradle_version: String by settings
|
val mixingradle_version: String by settings
|
||||||
|
|
||||||
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = forge_gradle_version)
|
classpath(group = "net.neoforged.gradle", name = "userdev", version = forge_gradle_version)
|
||||||
|
classpath(group = "net.neoforged.gradle", name = "mixin", version = forge_gradle_version)
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
|
||||||
classpath("org.spongepowered:mixingradle:${mixingradle_version}")
|
classpath("org.spongepowered:mixingradle:${mixingradle_version}")
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||||
modLoader="javafml" #mandatory
|
modLoader="javafml" #mandatory
|
||||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||||
loaderVersion="[47,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
loaderVersion="[21,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
license="2 Clause BSD"
|
license="2 Clause BSD"
|
||||||
@ -41,7 +41,7 @@ Matter. Energy. Combined.
|
|||||||
# Does this dependency have to exist - if not, ordering below must be specified
|
# Does this dependency have to exist - if not, ordering below must be specified
|
||||||
mandatory=true #mandatory
|
mandatory=true #mandatory
|
||||||
# The version range of the dependency
|
# The version range of the dependency
|
||||||
versionRange="[48.0.0,)" #mandatory
|
versionRange="[51.0.0,)" #mandatory
|
||||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
# Side this dependency is applied on - BOTH, CLIENT or SERVER
|
||||||
@ -50,7 +50,7 @@ Matter. Energy. Combined.
|
|||||||
[[dependencies.${mod_id}]]
|
[[dependencies.${mod_id}]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
versionRange="[1.20.2,1.21)"
|
versionRange="[1.21,1.21.1)"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
Loading…
Reference in New Issue
Block a user