Skip to content

Commit

Permalink
Update to Minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Jul 21, 2024
1 parent 7e952e9 commit 388135d
Show file tree
Hide file tree
Showing 29 changed files with 220 additions and 314 deletions.
156 changes: 54 additions & 102 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
plugins {
id 'eclipse'
id 'idea'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7+'
id 'java-library'
id 'net.neoforged.moddev' version '1.0.0'
}

jarJar.enable()

group = 'com.lovetropics.donations'
base {
archivesName = 'LTDonations'
Expand All @@ -26,135 +23,90 @@ if (System.getenv('GHA_RELEASE_WORKFLOW')) {
version = "${mod_version}-${release_type}+${buildnumber}"
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

minecraft {
mappings channel: 'parchment', version: parchment_version
neoForge {
version = project.neo_version

runs {
client {
taskName 'ltdonations_client'
copyIdeResources = true
arg "-mixin.config=ltdonations.mixins.json"
parchment {
minecraftVersion = minecraft_version
mappingsVersion = parchment_version
}

workingDirectory project.file('run')
addModdingDependenciesTo sourceSets.test

property 'forge.logging.console.level', 'info'
runs {
client {
client()

mods {
ltdonations {
source sourceSets.main
}
}
programArguments.addAll '--username', 'Dev###'
}

server {
taskName 'ltdonations_server'
copyIdeResources = true
arg "-mixin.config=ltdonations.mixins.json"
server()

workingDirectory project.file('run')
programArgument '--nogui'
}

property 'forge.logging.console.level', 'info'
data {
data()

mods {
ltdonations {
source sourceSets.main
}
}
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}

data {
taskName 'ltdonations_data'
copyIdeResources = true
arg "-mixin.config=ltdonations.mixins.json"

workingDirectory project.file('run')

environment 'target', 'fmluserdevdata'

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
ltdonations {
source sourceSets.main
}
}

args '--mod', 'ltdonations', '--all', '--output', '"' + rootProject.file('src/generated/resources/') + '"',
'--existing', '"' + sourceSets.main.resources.srcDirs[0] + '"'


configureEach {
logLevel = org.slf4j.event.Level.INFO
}
}
}

mixin {
add sourceSets.main, "ltdonations.refmap.json"
mods {
"${project.mod_id}" {
sourceSet sourceSets.main
sourceSet sourceSets.test
}
}
}

sourceSets.main.resources {
srcDir 'src/generated/resources'
srcDir 'src/generated/resources'
}

repositories {
maven { // Registrate
url "https://maven.tterrag.com/"
}
mavenLocal()
maven { url = "https://maven.ithundxr.dev/snapshots/" }
maven { url = "https://maven.tterrag.com/" }
mavenLocal()
}

dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

jarJar(implementation(fg.deobf("com.tterrag.registrate:Registrate:$registrate_version"))) {
jarJar.ranged(it, "[$registrate_version,MC1.21)")
}

jarJar(implementation(fg.deobf("com.lovetropics.lib:LTLib:$ltlib_version")))
jarJar(implementation(fg.deobf("eu.pb4:placeholder-api:$placeholder_api_version")))

if (System.getProperty("idea.sync.active") != "true") {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
jarJar(implementation("com.tterrag.registrate:Registrate:$registrate_version")) {
version {
strictly "[MC1.21-${registrate_version},MC1.22)"
prefer "MC1.21-${registrate_version}"
}
}
}

tasks.jarJar.configure {
archiveClassifier = ''
finalizedBy 'reobfJarJar'
jarJar(implementation("com.lovetropics.lib:LTLib:$ltlib_version"))
jarJar(implementation("eu.pb4:placeholder-api:$placeholder_api_version"))
}

reobf {
jarJar { }
}
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
mod_version: mod_version,
]
inputs.properties replaceProperties

jar {
archiveClassifier = 'slim'

manifest {
attributes([
"Specification-Title": "ltdonations",
"Specification-Vendor": "lovetropics",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": archiveVersion,
"Implementation-Vendor" :"lovetropics",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "ltdonations.mixins.json"
])
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}

def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
mod_version: mod_version,
]

processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

filesMatching(resourceTargets) {
expand replaceProperties
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
24 changes: 13 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
mod_version=1.3.0
mod_id=ltdonations
mod_version=1.4.0
release_type=release
minecraft_version=1.20.1
forge_version=47.0.19
parchment_version=2023.06.26-1.20.1
minecraft_version=1.21
neo_version=21.0.58-beta
parchment_version=2024.06.23

registrate_version=MC1.20-1.3.3
ltlib_version=[1.3.13,1.4)
placeholder_api_version=[2.1,2.2)
registrate_version=1.3.0+35
ltlib_version=[1.4.5,1.5)
placeholder_api_version=[2.5,2.6)

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
31 changes: 18 additions & 13 deletions gradlew
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
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.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# 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"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
7 changes: 2 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/maven' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
maven { url = 'https://maven.neoforged.net/releases' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
Loading

0 comments on commit 388135d

Please sign in to comment.