From c1f5c126e2ecdd1e0c7bbf051ec355a2c12c7a11 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:14:52 -0700 Subject: [PATCH] Configure mod-publish-plugin --- build.gradle | 27 +++++++++++++++++++ fabric/build.gradle | 19 +++++++++++++ neoforge/build.gradle | 21 +++++++++++++++ .../resources/META-INF/neoforge.mods.toml | 4 +++ .../scheduling/ChunkHolderManager.java | 3 +++ 5 files changed, 74 insertions(+) diff --git a/build.gradle b/build.gradle index c53cbc79..46fc90f3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,8 @@ +import me.modmuss50.mpp.ReleaseType + plugins { id("xyz.jpenilla.quiet-architectury-loom") + id("me.modmuss50.mod-publish-plugin") version "0.7.2" apply false } /* @@ -97,6 +100,30 @@ subprojects { ideConfigGenerated true // property "mixin.debug", "true" } + + plugins.apply("me.modmuss50.mod-publish-plugin") + + publishMods { + file = remapJar.archiveFile + if (project.version.contains("-beta.")) { + type = ReleaseType.BETA + } else { + type = ReleaseType.STABLE + } + changelog = providers.environmentVariable("RELEASE_NOTES") + + modrinth { + projectId = "" // TODO + accessToken = providers.environmentVariable("MODRINTH_TOKEN") + minecraftVersions = [rootProject.minecraft_version] + } + + curseforge { + projectId = "" // TODO + accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") + minecraftVersions = [rootProject.minecraft_version] + } + } } loom.runs.all { diff --git a/fabric/build.gradle b/fabric/build.gradle index e6c7cbfb..d09dffd9 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -45,6 +45,25 @@ shadowJar { relocate 'org.yaml.snakeyaml', 'ca.spottedleaf.moonrise.libs.org.yaml.snakeyaml' } +publishMods { + modLoaders = ["fabric"] + + modrinth { + incompatible( + "notenoughcrashes", + "starlight", + "c2me-fabric" + ) + } + curseforge { + incompatible( + "not-enough-crashes", + "starlight", + "c2me-fabric" + ) + } +} + // Setup a run with lithium for compatibility testing sourceSets.create("lithium") configurations.create("lithium") diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 5f284578..8f463b61 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -46,3 +46,24 @@ shadowJar { } Aw2At.setup(getProject(), tasks.remapJar) + +publishMods { + modLoaders = ["neoforge"] + + modrinth { + incompatible( + "notenoughcrashes", + "starlight-forge", + "canary", + "radium" + ) + } + curseforge { + incompatible( + "not-enough-crashes-forge", + "starlight-forge", + "canary", + "radium-reforged" + ) + } +} diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index 68097c67..165367a1 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -28,6 +28,10 @@ versionRange = "[1.21,1.21.2)" ordering = "NONE" side = "BOTH" +[[dependencies.moonrise]] +modId = "notenoughcrashes" +type = "incompatible" + [[dependencies.moonrise]] modId = "starlight" type = "incompatible" diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java index a687a397..6ff55405 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java @@ -307,6 +307,9 @@ public void saveAllChunks(final boolean flush, final boolean shutdown, final boo ++savedPoi; ++saved; } + if (holder.getCurrentChunk() instanceof LevelChunk levelChunk) { + holder.world.unload(levelChunk); + } } } catch (final Throwable thr) { LOGGER.error("Failed to save chunk (" + holder.chunkX + "," + holder.chunkZ + ") in world '" + WorldUtil.getWorldName(this.world) + "'", thr);