Update more to 1.20

This commit is contained in:
zontreck 2023-11-19 02:37:33 -07:00
parent f3b1ccbd3a
commit 46815aeb78
7 changed files with 64 additions and 65 deletions

View file

@ -1,12 +1,13 @@
plugins { plugins {
id 'eclipse' id 'eclipse'
id 'idea'
id 'maven-publish' id 'maven-publish'
id 'java-library' id 'java-library'
id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+' id 'org.parchmentmc.librarian.forgegradle' version '1.+'
} }
version = "${mc_version}-${mod_version}" version = "${minecraft_version}-${mod_version}"
group = mod_group_id group = mod_group_id
base { base {
@ -17,15 +18,15 @@ java {
withSourcesJar() 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 { configurations {
provided provided
compile.extendsFrom(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'}" println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft { minecraft {
// The mappings can be changed at any time and must be in the following format. // The mappings can be changed at any time and must be in the following format.
// Channel: Version: // Channel: Version:
@ -40,8 +41,8 @@ minecraft {
// //
// Use non-default mappings at your own risk. They may not always work. // 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. // Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'parchment', version: "${parchment_version}-${mc_version}" mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
// mappings channel: 'official', version: "${mc_version}" // mappings channel: 'official', version: "${minecraft_version}"
copyIdeResources = true copyIdeResources = true
@ -51,7 +52,8 @@ minecraft {
// Default run configurations. // Default run configurations.
// These can be tweaked, removed, or duplicated as needed. // These can be tweaked, removed, or duplicated as needed.
runs { runs {
client { // applies to all the run configs below
configureEach {
workingDirectory project.file('run') workingDirectory project.file('run')
// Recommended logging data for a userdev environment // 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 // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'libzontreck'
mods { mods {
libzontreck { "${mod_id}" {
source sourceSets.main source sourceSets.main
} }
} }
} }
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
server { 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 { data {
workingDirectory project.file('runData') // example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. // 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/') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
libzontreck {
source sourceSets.main
}
}
} }
} }
} }
@ -145,15 +136,15 @@ dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed // 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. // 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. // 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 // 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 // compileOnly fg.deobf("mezz.jei:jei-${minecraft_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 // 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${mc_version}-${registrate_version}") // Adds registrate as a dependency // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${minecraft_version}-${registrate_version}") // Adds registrate as a dependency
// Examples using mod jars from ./libs // 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}") //compileOnly ("net.luckperms:api:${luckperms_api_version}")
//runtimeOnly fg.deobf("curse.maven:luckperms-431733:4443551") //runtimeOnly fg.deobf("curse.maven:luckperms-431733:4443551")
//implementation fg.deobf("blank:LuckPerms:Forge-5.4.12") //implementation fg.deobf("blank:LuckPerms:Forge-5.4.12")
@ -174,11 +165,11 @@ dependencies {
tasks.named('processResources', ProcessResources).configure { tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [ var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range, forge_version : forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_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_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description, mod_authors : mod_authors, mod_description: mod_description,
] ]
inputs.properties replaceProperties inputs.properties replaceProperties
@ -189,15 +180,15 @@ tasks.named('processResources', ProcessResources).configure {
tasks.named('jar', Jar).configure { tasks.named('jar', Jar).configure {
from { from {
configurations.provided.asFileTree.collect{zipTree(it)} configurations.provided.asFileTree.collect { zipTree(it) }
} }
manifest { manifest {
attributes([ attributes([
"Specification-Title" : mod_id, "Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors, "Specification-Vendor" : mod_authors,
"Specification-Version": "${mod_version}", "Specification-Version" : "${mod_version}",
"Implementation-Title": project.name, "Implementation-Title" : project.name,
"Implementation-Version": "${mod_version}", "Implementation-Version" : "${mod_version}",
"Implementation-Vendor" : mod_authors, "Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") "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 options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
} }
artifacts { artifacts {
archives sourcesJar archives sourcesJar
} }

View file

@ -3,7 +3,6 @@
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
mc_version=1.20.1
forge_version=47.2.0 forge_version=47.2.0
parchment_version=2023.09.03 parchment_version=2023.09.03
# luckperms_api_version=5.4 # luckperms_api_version=5.4
@ -17,9 +16,12 @@ eventsbus=1.0.16
forge_version_range=[47,) forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds # The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[47,) loader_version_range=[47,)
minecraft_range=[1.20.1,1.21] # The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20.1
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1,1.21)
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. # Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started # Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=official mapping_channel=official

Binary file not shown.

14
gradlew vendored Normal file → Executable file
View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
#
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015-2021 the original authors.
# #
@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,10 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac

1
gradlew.bat vendored
View file

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%

View file

@ -46,7 +46,7 @@ This mod provides common code to all of zontreck's mods.
''' '''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.libzontreck]] #optional [[dependencies.${mod_id}]] #optional
# the modid of the dependency # the modid of the dependency
modId="forge" #mandatory modId="forge" #mandatory
# 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
@ -58,7 +58,7 @@ This mod provides common code to all of zontreck's mods.
# Side this dependency is applied on - BOTH, CLIENT or SERVER # Side this dependency is applied on - BOTH, CLIENT or SERVER
side="BOTH" side="BOTH"
# Here's another dependency # Here's another dependency
[[dependencies.libzontreck]] [[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

View file

@ -1,8 +1,8 @@
{ {
"pack": { "pack": {
"description": "libzontreck resources", "description": {
"pack_format": 9, "text": "${mod_id} Resources. This is a library mod"
"forge:resource_pack_format": 9, }
"forge:data_pack_format": 9 "pack_format": 15
} }
} }