diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 25da30d..7101f8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -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 - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -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 - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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 + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts index f2ba952..8317aaf 100644 --- a/neoforge/build.gradle.kts +++ b/neoforge/build.gradle.kts @@ -1,216 +1,208 @@ -@file:Suppress("SpellCheckingInspection") - -import net.neoforged.gradle.dsl.common.runs.run.Run -import org.ajoberstar.grgit.Grgit -import java.text.SimpleDateFormat -import java.util.* - -var envVersion: String = System.getenv("VERSION") ?: "9.9.9" -if (envVersion.startsWith("v")) - envVersion = envVersion.trimStart('v') - -val modId: String = property("mod_id") as String -val isRelease: Boolean = (System.getenv("RELEASE") ?: "false").equals("true", true) - -plugins { - id("idea") - id("eclipse") - id("maven-publish") - id("java-library") - id("net.neoforged.gradle.userdev") version ("7.0.119") - id("org.ajoberstar.grgit") version ("5.2.1") -} - -base { - archivesName.set(modId) - group = "dev.compactmods.simplehoney" - version = envVersion -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(21)) -} - -sourceSets.main { - java { - srcDir("src/main/java") - } - - resources { - srcDir("src/main/resources") - srcDir("src/generated/resources") - } -} - -sourceSets.test { - java { - srcDir("src/test/java") - } - - resources { - srcDir("src/test/resources") - } -} - -minecraft { - modIdentifier.set(modId) - // accessTransformers.file(project.file("src/main/resources/META-INF/accesstransformer.cfg")) -} - -runs { - // applies to all the run configs below - configureEach { - // Recommended logging data for a userdev environment - systemProperty("forge.logging.markers", "") // 'SCAN,REGISTRIES,REGISTRYDUMP' - - // Recommended logging level for the console - systemProperty("forge.logging.console.level", "debug") - - if (!System.getenv().containsKey("CI")) { - // JetBrains Runtime Hotswap - // jvmArgument("-XX:+AllowEnhancedClassRedefinition") - } - - modSource(sourceSets.main.get()) - } - - create("client") { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - systemProperty("forge.enabledGameTestNamespaces", modId) - - programArguments("--username", "Nano") - programArguments("--width", "1920") - programArguments("--height", "1080") - } - - create("server") { - systemProperty("forge.enabledGameTestNamespaces", modId) - environmentVariables("TEST_RESOURCES", project.file("src/test/resources").path) - modSource(project.sourceSets.test.get()) - } - - create("data") { - dataGenerator(true) - - programArguments("--mod", modId) - programArguments("--all") - programArguments("--output", file("src/generated/resources").absolutePath) - programArguments("--existing", file("src/main/resources").absolutePath) - } - - create("gameTestServer") { - systemProperty("forge.enabledGameTestNamespaces", modId) - environmentVariable("TEST_RESOURCES", file("src/test/resources").path) - modSource(project.sourceSets.test.get()) - } -} - -repositories { - mavenLocal() - - maven("https://maven.blamejared.com/") { - // location of the maven that hosts JEI files since January 2023 - name = "Jared's maven" - } - - maven("https://www.cursemaven.com") { - content { - includeGroup("curse.maven") - } - } - - maven("https://modmaven.dev") { - // location of a maven mirror for JEI files, as a fallback - name = "ModMaven" - } -} - -dependencies { - // Core Projects and Libraries - this { - implementation(libraries.neoforge) - } - - // Mods - compileOnly(mods.bundles.jei) - compileOnly(mods.jade) -} - -tasks.withType { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -tasks.withType { - options.encoding = "UTF-8" -} - -tasks.withType { - val mainGit = Grgit.open { - currentDir = project.rootDir - } - - this.exclude("dev/compactmods/simplehoney/datagen/**") - - manifest { - val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) - attributes(mapOf( - "Specification-Title" to "Simple Honey", - "Specification-Vendor" to "CompactMods", - "Specification-Version" to "2", - "Implementation-Title" to "Simple Honey", - "Implementation-Version" to envVersion, - "Implementation-Vendor" to "CompactMods", - "Implementation-Timestamp" to now, - "Minecraft-Version" to libraries.versions.minecraft.get(), - "NeoForge-Version" to libraries.versions.neoforge.get(), - "Main-Commit" to mainGit.head().id - )) - } -} - -fun prop(name: String): String { - if (project.properties.containsKey(name)) - return project.property(name) as String; - - return ""; -} - -tasks.withType().configureEach { - var replaceProperties: Map = mapOf( - "minecraft_version" to libraries.versions.minecraft.get(), - "neo_version" to libraries.versions.neoforge.get(), - "minecraft_version_range" to prop("minecraft_version_range"), - "neo_version_range" to prop("neo_version_range"), - "loader_version_range" to prop("loader_version_range"), - "mod_id" to modId, - "mod_name" to prop("mod_name"), - "mod_license" to prop("mod_license"), - "mod_version" to envVersion, - "mod_authors" to prop("mod_authors"), - "mod_description" to prop("mod_description") - ) - - inputs.properties(replaceProperties) - filesMatching("META-INF/neoforge.mods.toml") { - expand(replaceProperties) - } -} - -val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/simplehoney" -publishing { - publications.register("simplehoney") { - artifactId = "$modId-neoforge" - from(components.getByName("java")) - } - - repositories { - // GitHub Packages - maven(PACKAGES_URL) { - name = "GitHubPackages" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } +@file:Suppress("SpellCheckingInspection") + +import java.text.SimpleDateFormat +import java.util.* + +var envVersion: String = System.getenv("VERSION") ?: "9.9.9" +if (envVersion.startsWith("v")) + envVersion = envVersion.trimStart('v') + +val modId: String = property("mod_id") as String +val isRelease: Boolean = (System.getenv("RELEASE") ?: "false").equals("true", true) + +plugins { + id("idea") + id("eclipse") + id("maven-publish") + id("java-library") + id("net.neoforged.gradle.userdev") version ("7.0.119") +} + +base { + archivesName.set(modId) + group = "dev.compactmods.simplehoney" + version = envVersion +} + +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(21)) +} + +sourceSets.main { + java { + srcDir("src/main/java") + } + + resources { + srcDir("src/main/resources") + srcDir("src/generated/resources") + } +} + +sourceSets.test { + java { + srcDir("src/test/java") + } + + resources { + srcDir("src/test/resources") + } +} + +minecraft { + modIdentifier.set(modId) + // accessTransformers.file(project.file("src/main/resources/META-INF/accesstransformer.cfg")) +} + +runs { + // applies to all the run configs below + configureEach { + // Recommended logging data for a userdev environment + systemProperty("forge.logging.markers", "") // 'SCAN,REGISTRIES,REGISTRYDUMP' + + // Recommended logging level for the console + systemProperty("forge.logging.console.level", "debug") + + if (!System.getenv().containsKey("CI")) { + // JetBrains Runtime Hotswap + // jvmArgument("-XX:+AllowEnhancedClassRedefinition") + } + + modSource(sourceSets.main.get()) + } + + create("client") { + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + systemProperty("forge.enabledGameTestNamespaces", modId) + + programArguments("--username", "Nano") + programArguments("--width", "1920") + programArguments("--height", "1080") + } + + create("server") { + systemProperty("forge.enabledGameTestNamespaces", modId) + environmentVariables("TEST_RESOURCES", project.file("src/test/resources").path) + modSource(project.sourceSets.test.get()) + } + + create("data") { + dataGenerator(true) + + programArguments("--mod", modId) + programArguments("--all") + programArguments("--output", file("src/generated/resources").absolutePath) + programArguments("--existing", file("src/main/resources").absolutePath) + } + + create("gameTestServer") { + systemProperty("forge.enabledGameTestNamespaces", modId) + environmentVariable("TEST_RESOURCES", file("src/test/resources").path) + modSource(project.sourceSets.test.get()) + } +} + +repositories { + mavenLocal() + + maven("https://maven.blamejared.com/") { + // location of the maven that hosts JEI files since January 2023 + name = "Jared's maven" + } + + maven("https://www.cursemaven.com") { + content { + includeGroup("curse.maven") + } + } + + maven("https://modmaven.dev") { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + } +} + +dependencies { + implementation(libraries.neoforge) +} + +tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +tasks.withType { + options.encoding = "UTF-8" +} + +tasks.withType { + val gitVersion = providers.exec { + commandLine("git", "rev-parse", "HEAD") + }.standardOutput.asText.get() + + this.exclude("dev/compactmods/simplehoney/datagen/**") + + manifest { + val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) + attributes( + mapOf( + "Specification-Title" to "Simple Honey", + "Specification-Vendor" to "CompactMods", + "Specification-Version" to "2", + "Implementation-Title" to "Simple Honey", + "Implementation-Version" to envVersion, + "Implementation-Vendor" to "CompactMods", + "Implementation-Timestamp" to now, + "Minecraft-Version" to libraries.versions.minecraft.get(), + "NeoForge-Version" to libraries.versions.neoforge.get(), + "Main-Commit" to gitVersion + ) + ) + } +} + +fun prop(name: String): String { + if (project.properties.containsKey(name)) + return project.property(name) as String; + + return ""; +} + +tasks.withType().configureEach { + var replaceProperties: Map = mapOf( + "minecraft_version" to libraries.versions.minecraft.get(), + "neo_version" to libraries.versions.neoforge.get(), + "minecraft_version_range" to prop("minecraft_version_range"), + "neo_version_range" to prop("neo_version_range"), + "loader_version_range" to prop("loader_version_range"), + "mod_id" to modId, + "mod_name" to prop("mod_name"), + "mod_license" to prop("mod_license"), + "mod_version" to envVersion, + "mod_authors" to prop("mod_authors"), + "mod_description" to prop("mod_description") + ) + + inputs.properties(replaceProperties) + filesMatching("META-INF/neoforge.mods.toml") { + expand(replaceProperties) + } +} + +val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/simplehoney" +publishing { + publications.register("simplehoney") { + artifactId = "$modId-neoforge" + from(components.getByName("java")) + } + + repositories { + // GitHub Packages + maven(PACKAGES_URL) { + name = "GitHubPackages" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } \ No newline at end of file diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties index ec4209b..7467c80 100644 --- a/neoforge/gradle.properties +++ b/neoforge/gradle.properties @@ -1,16 +1,16 @@ -#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings -# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started -neogradle.subsystems.parchment.minecraftVersion=1.20.6 -neogradle.subsystems.parchment.mappingsVersion=2024.05.01 - -# Environment Properties -minecraft_version_range=[1.20.6,1.21) -neo_version_range=[20.6,) -loader_version_range=[2,) - -## Mod Properties -mod_name=Simple Honey -mod_license=MIT -mod_group_id=dev.compactmods.simplehoney -mod_authors=RobotGryphon +#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings +# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started +neogradle.subsystems.parchment.minecraftVersion=1.21 +neogradle.subsystems.parchment.mappingsVersion=2024.07.28 + +# Environment Properties +minecraft_version_range=[1.21,1.22) +neo_version_range=[21.0,) +loader_version_range=[2,) + +## Mod Properties +mod_name=Simple Honey +mod_license=MIT +mod_group_id=dev.compactmods.simplehoney +mod_authors=RobotGryphon mod_description=Because working with vanilla beehives is pain. \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 1d578d0..d9904f8 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,54 +1,45 @@ -dependencyResolutionManagement { - versionCatalogs.create("libraries") { - library("neoforge", "net.neoforged", "neoforge") - .versionRef("neoforge") - - version("minecraft", "1.20.6") - version("neoforge", "20.6.57-beta") - } - - versionCatalogs.create("mods") { - this.library("jei-common", "mezz.jei", "jei-1.20.4-common-api").versionRef("jei") - this.library("jei-neo", "mezz.jei", "jei-1.20.4-neoforge-api").versionRef("jei"); - this.bundle("jei", listOf("jei-common", "jei-neo")) - this.version("jei", "17.3.0.49") - - this.library("jade", "curse.maven", "jade-324717").version("5109393") - } -} - -pluginManagement { - plugins { - id("idea") - id("eclipse") - id("maven-publish") - id("java-library") - } - - repositories { - mavenLocal() - mavenCentral() - gradlePluginPortal() - - // maven("https://maven.architectury.dev/") - - maven("https://maven.parchmentmc.org") { - name = "ParchmentMC" - } - - maven("https://maven.neoforged.net/releases") { - name = "NeoForged" - } - - maven("https://repo.spongepowered.org/repository/maven-public/") { - name = "Sponge Snapshots" - } - } -} - -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version ("0.8.0") -} - -include("neoforge") - +dependencyResolutionManagement { + versionCatalogs.create("libraries") { + library("neoforge", "net.neoforged", "neoforge") + .versionRef("neoforge") + + version("minecraft", "1.21.0") + version("neoforge", "21.0.143") + } +} + +pluginManagement { + plugins { + id("idea") + id("eclipse") + id("maven-publish") + id("java-library") + } + + repositories { + mavenLocal() + mavenCentral() + gradlePluginPortal() + + // maven("https://maven.architectury.dev/") + + maven("https://maven.parchmentmc.org") { + name = "ParchmentMC" + } + + maven("https://maven.neoforged.net/releases") { + name = "NeoForged" + } + + maven("https://repo.spongepowered.org/repository/maven-public/") { + name = "Sponge Snapshots" + } + } +} + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version ("0.8.0") +} + +include("neoforge") +