Update more to 1.20
This commit is contained in:
parent
f3b1ccbd3a
commit
46815aeb78
7 changed files with 64 additions and 65 deletions
92
build.gradle
92
build.gradle
|
@ -1,12 +1,13 @@
|
|||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'java-library'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
}
|
||||
|
||||
version = "${mc_version}-${mod_version}"
|
||||
version = "${minecraft_version}-${mod_version}"
|
||||
group = mod_group_id
|
||||
|
||||
base {
|
||||
|
@ -17,15 +18,15 @@ java {
|
|||
withSourcesJar()
|
||||
}
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
configurations {
|
||||
provided
|
||||
compile.extendsFrom(provided)
|
||||
}
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
|
||||
minecraft {
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
|
@ -40,8 +41,8 @@ minecraft {
|
|||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'parchment', version: "${parchment_version}-${mc_version}"
|
||||
// mappings channel: 'official', version: "${mc_version}"
|
||||
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
|
||||
// mappings channel: 'official', version: "${minecraft_version}"
|
||||
|
||||
copyIdeResources = true
|
||||
|
||||
|
@ -51,7 +52,8 @@ minecraft {
|
|||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
client {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
|
@ -66,47 +68,36 @@ minecraft {
|
|||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', 'libzontreck'
|
||||
|
||||
mods {
|
||||
libzontreck {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('runServer')
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
property 'forge.enabledGameTestNamespaces', 'libzontreck'
|
||||
|
||||
mods {
|
||||
libzontreck {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('runData')
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
args '--mod', 'libzontreck', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
|
||||
mods {
|
||||
libzontreck {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,9 +116,9 @@ repositories {
|
|||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
flatDir {
|
||||
dir 'libs'
|
||||
dir 'libs'
|
||||
}
|
||||
|
||||
|
||||
//maven {
|
||||
// name = "CurseMaven"
|
||||
// url = "https://cursemaven.com"
|
||||
|
@ -145,15 +136,15 @@ dependencies {
|
|||
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
|
||||
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${minecraft_version}-${registrate_version}") // Adds registrate as a dependency
|
||||
|
||||
// Examples using mod jars from ./libs
|
||||
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
|
||||
// implementation fg.deobf("blank:coolmod-${minecraft_version}:${coolmod_version}")
|
||||
//compileOnly ("net.luckperms:api:${luckperms_api_version}")
|
||||
//runtimeOnly fg.deobf("curse.maven:luckperms-431733:4443551")
|
||||
//implementation fg.deobf("blank:LuckPerms:Forge-5.4.12")
|
||||
|
@ -174,11 +165,11 @@ dependencies {
|
|||
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version : forge_version, forge_version_range: forge_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors : mod_authors, mod_description: mod_description,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
|
@ -189,15 +180,15 @@ tasks.named('processResources', ProcessResources).configure {
|
|||
|
||||
tasks.named('jar', Jar).configure {
|
||||
from {
|
||||
configurations.provided.asFileTree.collect{zipTree(it)}
|
||||
configurations.provided.asFileTree.collect { zipTree(it) }
|
||||
}
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : mod_id,
|
||||
"Specification-Vendor" : mod_authors,
|
||||
"Specification-Version": "${mod_version}",
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${mod_version}",
|
||||
"Specification-Version" : "${mod_version}",
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : "${mod_version}",
|
||||
"Implementation-Vendor" : mod_authors,
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
|
@ -239,6 +230,7 @@ tasks.withType(JavaCompile).configureEach {
|
|||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
Reference in a new issue