From b5c8d72e0a0a3b57658ccbf6fc2ab70b7728397f Mon Sep 17 00:00:00 2001 From: TexTrue <65154269+TexBlock@users.noreply.github.com> Date: Fri, 3 May 2024 20:20:49 +0800 Subject: [PATCH] update Forge & MaFgLib version --- .github/workflows/build.yml | 8 +-- .github/workflows/release.yml | 10 +-- CHANGELOG.md | 2 +- build.gradle | 68 ++++++++----------- gradle.properties | 8 +-- settings.gradle | 3 +- .../fi/dy/masa/itemscroller/ItemScroller.java | 26 +++---- 7 files changed, 52 insertions(+), 73 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9334873..1b3de16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,14 +7,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: 17 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.gradle/caches @@ -26,7 +26,7 @@ jobs: chmod +x gradlew ./gradlew build - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts-forge path: ${{ github.workspace }}/build/libs \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be492c7..052b424 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,24 +14,24 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up JDK 20 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: 20 - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.gradle/caches ~/.gradle/wrapper .gradle key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }} - - uses: gradle/wrapper-validation-action@v1 + - uses: gradle/actions/wrapper-validation@v3 - run: | chmod +x gradlew - ./gradlew build publishCurseForge publish modrinth --stacktrace -Porg.gradle.parallel.threads=4 + ./gradlew build publishMod --stacktrace -Porg.gradle.parallel.threads=4 env: CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index d8fcfab..6774f07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,2 @@ ## Change -- update mafglib version to `0.1.9` \ No newline at end of file +- update Forge & MaFgLib version \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2593485..5d13d47 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,10 @@ plugins { - id "dev.architectury.loom" version "1.4-SNAPSHOT" + id "dev.architectury.loom" version "1.5-SNAPSHOT" id "maven-publish" - id 'com.modrinth.minotaur' version '2.+' - id 'net.darkhax.curseforgegradle' version '1.+' + id "com.hypherionmc.modutils.modpublisher" version "2.+" } -sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name +base.archivesName = project.archives_base_name version = "${project.mod_version}-mc${project.minecraft_version}" group = project.maven_group @@ -47,6 +44,9 @@ tasks.withType(JavaCompile) { } java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + withSourcesJar() } @@ -65,41 +65,6 @@ jar { } } -modrinth { - token = System.getenv("MODRINTH_TOKEN") - - projectId = "${project.modrinth_id}" - versionNumber = "${project.version}" - versionType = "beta" - changelog = file("CHANGELOG.md").getText('UTF-8') - uploadFile = remapJar - additionalFiles = [sourcesJar] - gameVersions = ["1.19", "1.19.1", "1.19.2"] - loaders = ["forge"] - dependencies { - required.project("mafglib") - } -} - -task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { - apiToken = System.getenv("CURSEFORGE_TOKEN") - disableVersionDetection() - - def mainFile = upload(project.curseforge_id, remapJar) - mainFile.displayName = "${project.version}" - mainFile.releaseType = "beta" - mainFile.changelog = file("CHANGELOG.md") - mainFile.changelogType = "markdown" - mainFile.addModLoader("Forge") - mainFile.addJavaVersion("Java 17", "Java 18") - mainFile.addGameVersion("1.19", "1.19.1", "1.19.2") - mainFile.addRequirement("mafglib") - - def sourcesFile = mainFile.withAdditionalFile(sourcesJar) - sourcesFile.changelog = file("CHANGELOG.md") - sourcesFile.changelogType = "markdown" -} - // configure the maven publication publishing { publications { @@ -116,3 +81,24 @@ publishing { // retrieving dependencies. } } + +publisher { + apiKeys { + modrinth System.getenv("MODRINTH_TOKEN") + curseforge System.getenv("CURSEFORGE_TOKEN") + } + + setCurseID("${project.curseforge_id}") + setModrinthID("${project.modrinth_id}") + setVersionType("release") + setChangelog(file("CHANGELOG.md").getText("UTF-8")) + setVersion("${project.version}") + setDisplayName("${project.version}") + setGameVersions("1.19", "1.19.1", "1.19.2") + setLoaders("forge") + setCurseEnvironment("client") + setArtifact(remapJar) + addAdditionalFile(sourcesJar) + curseDepends { required("mafglib") } + modrinthDepends { required("mafglib") } +} diff --git a/gradle.properties b/gradle.properties index 8dc539e..4ab0583 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ loom.platform=forge # minecraft version minecraft_version=1.19.2 # forge version, latest version can be found on https://files.minecraftforge.net/ - forge_version=1.19.2-43.0.8 + forge_version=1.19.2-43.3.13 # yarn, latest version can be found on https://fabricmc.net/develop/ - yarn_mappings=1.19.2+build.3 + yarn_mappings=1.19.2+build.28 # Mod Properties - mod_version=0.1.2 + mod_version=0.1.3 maven_group=org.thinkingstudio.rocknroller archives_base_name=RocknRoller mod_id=rocknroller @@ -21,4 +21,4 @@ loom.platform=forge curseforge_id=916852 # Dependencies - malilib_version=0.1.9-mc1.19.2 \ No newline at end of file + malilib_version=0.1.10-mc1.19.2 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 606cfc1..486e840 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,9 @@ pluginManagement { - // when using additional gradle plugins like shadow, - // add their repositories to this list! repositories { maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } maven { url "https://files.minecraftforge.net/maven/" } + maven { url "https://maven.firstdark.dev/releases" } gradlePluginPortal() } } diff --git a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java index a23527f..3212825 100644 --- a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java +++ b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java @@ -2,10 +2,8 @@ import fi.dy.masa.itemscroller.gui.GuiConfigs; import fi.dy.masa.malilib.compat.forge.ForgePlatformUtils; -import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.fml.loading.FMLLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import fi.dy.masa.malilib.event.InitializationHandler; @@ -15,19 +13,15 @@ public class ItemScroller { public static final Logger logger = LogManager.getLogger(Reference.MOD_ID); public ItemScroller() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + if (FMLLoader.getDist().isClient()) { + ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly(); + InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); - modEventBus.addListener(this::onInitializeClient); - } - - public void onInitializeClient(FMLClientSetupEvent event) { - ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly(); - InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); - - ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> { - GuiConfigs gui = new GuiConfigs(); - gui.setParent(screen); - return gui; - }); + ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> { + GuiConfigs gui = new GuiConfigs(); + gui.setParent(screen); + return gui; + }); + } } }