diff --git a/build.gradle b/build.gradle index f216a5668..db0c917a0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,12 @@ -buildscript { - repositories { - maven { url = 'https://maven.minecraftforge.net' } - mavenCentral() - maven { url = 'https://repo.spongepowered.org/repository/maven-public' } - maven { url = 'https://maven.parchmentmc.org' } - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: false - classpath "org.spongepowered:mixingradle:${mixingradle_version}" - classpath "org.parchmentmc:librarian:${librarian_version}" - } -} - plugins { + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.minecraftforge.gradle' version "${forgegradle_version}" + id 'org.spongepowered.mixin' version "${mixingradle_version}" + id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}" id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" } -apply plugin: 'net.minecraftforge.gradle' -apply plugin: 'org.parchmentmc.librarian.forgegradle' -apply plugin: 'eclipse' -apply plugin: 'maven-publish' -apply plugin: 'org.spongepowered.mixin' jarJar.enable() @@ -33,63 +20,37 @@ version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') 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 { mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + copyIdeResources = true + runs { - client { + configureEach { workingDirectory project.file('run') property 'forge.logging.markers', '' property 'forge.logging.console.level', 'debug' - property 'mixin.debug.export', 'true' + property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" + + mods { + flywheel { + source sourceSets.main + } + } + } + + client { property 'flw.dumpShaderSource', 'true' property 'flw.loadRenderDoc', 'true' property 'flw.debugMemorySafety', 'true' - - arg '-mixin.config=flywheel.mixins.json' - arg '-mixin.config=flywheel.sodium.mixins.json' - - mods { - flywheel { - source sourceSets.main - } - } } server { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - arg '-mixin.config=flywheel.mixins.json' - arg '-mixin.config=flywheel.sodium.mixins.json' - - mods { - flywheel { - source sourceSets.main - } - } - } - - data { - workingDirectory project.file('run') - - 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. - args '--mod', 'flywheel', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - flywheel { - source sourceSets.main - } - } + args '--nogui' } } } @@ -115,7 +76,7 @@ repositories { mavenCentral() } -// Fix for loading non-mod libraries in dev-env, used for JOML and Miniball. +// Fix for loading non-mod libraries in dev-env, used for Miniball. // https://gist.github.com/SizableShrimp/66b22f1b24c255e1491c8d98d3f11f83 // v--------------------------------------------------------------------v configurations { @@ -123,7 +84,7 @@ configurations { implementation.extendsFrom library } -minecraft.runs.all { +minecraft.runs.configureEach { lazyToken('minecraft_classpath') { configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) } @@ -134,21 +95,12 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - jarJar('org.joml:joml:1.10.5') { - jarJar.ranged(it, '[1.10.5,1.11.0)') - } - library 'org.joml:joml:1.10.5' + compileOnly fg.deobf("maven.modrinth:rubidium:0.6.5") + compileOnly fg.deobf("maven.modrinth:oculus:1.20-1.6.4") - jarJar('com.dreizak:miniball:1.0.3') { - jarJar.ranged(it, '[1.0.3,2.0.0)') - } + jarJar(group: 'com.dreizak', name: 'miniball', version: '[1.0.3,2.0.0)') library 'com.dreizak:miniball:1.0.3' - // switch to implementation for debugging - compileOnly fg.deobf("maven.modrinth:starlight-forge:1.0.2+1.18.2") - compileOnly fg.deobf("maven.modrinth:rubidium:0.5.6") - compileOnly fg.deobf("maven.modrinth:oculus:1.18.2-1.5.2") - // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly @@ -163,6 +115,12 @@ test { mixin { add sourceSets.main, 'flywheel.refmap.json' + + config 'flywheel.mixins.json' + config 'flywheel.sodium.mixins.json' + + debug.verbose = true + debug.export = true } // Workaround for SpongePowered/MixinGradle#38 @@ -185,19 +143,33 @@ compileJava { options.compilerArgs = ['-Xdiags:verbose'] } -jar { +void addLicense(jarTask) { + jarTask.from('LICENSE.md') { + rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' + } +} + +tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : 'flywheel', //'Specification-Vendor': 'flywheel authors', 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.jar.baseName, + 'Implementation-Title': project.jar.archiveBaseName, 'Implementation-Version' : project.jar.archiveVersion, //'Implementation-Vendor': 'flywheel authors', 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 'MixinConfigs' : 'flywheel.mixins.json,flywheel.sodium.mixins.json' ]) } + + finalizedBy 'reobfJar' + addLicense(it) +} + +tasks.named('jarJar').configure { + finalizedBy 'reobfJarJar' + addLicense(it) } java { @@ -205,29 +177,20 @@ java { withJavadocJar() } -void addLicense(jarTask) { - jarTask.from('LICENSE.md') { - rename '(.*)\\.(.*)', '$1_' + archivesBaseName + '.$2' - } -} - -jar.finalizedBy('reobfJar') -tasks.jarJar.finalizedBy('reobfJarJar') -addLicense(jar) -addLicense(tasks.jarJar) - publishing { publications { - mavenJava(MavenPublication) { - artifactId = archivesBaseName + register('mavenJava', MavenPublication) { + artifact jar - from components.java fg.component(it) jarJar.component(it) } } - repositories { + maven { + url "file://${project.projectDir}/mcmodsrepo" + } + if (project.hasProperty('mavendir')) { maven { url mavendir } } @@ -246,6 +209,6 @@ curseforge { changelog = file('changelog.txt') releaseType = project.curse_type mainArtifact jar - addGameVersion '1.18.2' + addGameVersion '1.20.2' } } diff --git a/gradle.properties b/gradle.properties index 26c1ac393..50ce641ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,18 +3,17 @@ org.gradle.daemon = false # mod version info mod_version = 1.0.0-alpha -artifact_minecraft_version = 1.18.2 - -minecraft_version=1.18.2 -forge_version=40.2.4 +artifact_minecraft_version=1.20 +minecraft_version=1.20.2 +forge_version=48.0.40 # build dependency versions -forgegradle_version=5.1.+ -mixingradle_version=0.7-SNAPSHOT +forgegradle_version=[6.0.16,6.2) +mixingradle_version=0.7.+ mixin_version = 0.8.5 librarian_version = 1.+ cursegradle_version = 1.4.0 -parchment_version = 2022.11.06 +parchment_version=2023.10.22 # curseforge info projectId = 486392 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a4..c1962a79e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fcea..309b4e18d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c78733..aeb74cbb4 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (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. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# 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"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -143,12 +140,16 @@ fi 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 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 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# 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, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in @@ -205,6 +210,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 6d647c44e..26eaa3d68 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,18 @@ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + maven { url = 'https://repo.spongepowered.org/repository/maven-public' } + maven { url = 'https://maven.parchmentmc.org' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + rootProject.name = 'Flywheel-Forge' diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 3ddcc67c7..c63e6a3d1 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader = "javafml" -loaderVersion = "[40,)" +loaderVersion = "[48,)" issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues" license = "MIT" @@ -18,13 +18,13 @@ A modern engine for modded minecraft.''' [[dependencies.flywheel]] modId = "forge" mandatory = true -versionRange = "[40.0.0,)" +versionRange = "[48.0.0,)" ordering = "NONE" side = "CLIENT" [[dependencies.flywheel]] modId = "minecraft" mandatory = true -versionRange = "[1.18.2,1.19)" +versionRange = "[1.20.2,)" ordering = "NONE" side = "CLIENT" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 2d8d4da03..7b5692da4 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Flywheel resources", - "pack_format": 8 + "pack_format": 18 } }