diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md deleted file mode 100644 index 33cd133..0000000 --- a/DEVELOPMENT.md +++ /dev/null @@ -1,42 +0,0 @@ -# Development - -BetterHUD is built to support several Minecraft versions from one codebase with -[Stonecutter](https://stonecutter.kikugie.dev/). Each build variant -(`versions//gradle.properties`) produces one jar covering a range of -Minecraft versions. - -### Adding a new Minecraft version - -[`supported-versions.json`](supported-versions.json) is the source of truth for every supported Minecraft version. - -1. Add an entry to `supported-versions.json` (keep the order oldest → newest): - - `variant`: the build variant whose jar covers the new version. Reuse the - newest variant if the mod still compiles and runs on it; create a new - variant only when the new Minecraft breaks the current code. - - `fabricApi`, `modmenu`, `cloth`: the newest releases built for that - Minecraft version (check each project's maven or Modrinth page — the - launch test will catch runtime-incompatible picks). - - `clientGametest`: `true` (every version since 1.21.4 has the module). -2. If a new variant is needed: create `versions//gradle.properties` - (copy the newest one and adjust the versions and `mc_dep` range), cap the - previous variant's `mc_dep`, and add any `//?` Stonecutter guards the new - Minecraft requires in the sources. - -To launch-test one version locally: -`./gradlew :launchtest:runProductionClientGameTest -PtestMcVersion=` - -### Releasing to Modrinth and CurseForge - -Bump `mod_version` in `gradle.properties`, push, wait for CI to go green, -then run the **publish** workflow from the Actions tab (Run workflow). -The workflow asks for a changelog, a release channel (release/beta/alpha), and which platforms to publish to. - -It needs two repository secrets: `MODRINTH_TOKEN` (a -[Modrinth PAT](https://modrinth.com/settings/pats) with the "Create versions" -scope) and `CURSEFORGE_TOKEN` (a -[CurseForge API token](https://legacy.curseforge.com/account/api-tokens)). - -For a manual upload instead, run `./gradlew modrinthBundle` (or download the -`modrinth-upload` artifact from any CI run). It produces `build/modrinth/` -containing every release jar plus `UPLOAD.md`, which lists exactly which -Minecraft versions to select for each jar. diff --git a/build.gradle b/build.gradle index 6ea0f99..ee82dc8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,6 @@ def hasHudElementRegistry = stonecutter.eval(mcVersion, '>=1.21.6') // 1.21.6+ apply plugin: isLegacy ? 'net.fabricmc.fabric-loom-remap' : 'net.fabricmc.fabric-loom' -// Per-MC Java version (21 for 1.21.x, 25 for 26.1+). def javaVersionInt = Integer.parseInt(project.java_version) def javaLang = JavaVersion.toVersion(javaVersionInt) def mixinJavaCompat = "JAVA_${javaVersionInt}" @@ -31,12 +30,8 @@ repositories { maven { url 'https://maven.terraformersmc.com/releases/' } } -// Adds the Modrinth maven and modmenuDependency(), a fallback for when the -// TerraformersMC maven is unreachable. apply from: "${rootDir}/gradle/modrinth-fallback.gradle" -// MC 26+ uses fabric-rendering-v1's transitive deps but rejects ASM coming from -// annotation processors. if (!isLegacy) { configurations.configureEach { if (name.toLowerCase().contains('annotationprocessor')) { @@ -45,9 +40,6 @@ if (!isLegacy) { } } -// Every variant declares fabric-api, modmenu, and cloth-config as runtime deps -// (not bundled). 1.21.x uses modImplementation for intermediary remapping; 26.x -// uses plain implementation against unobfuscated MC. dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" diff --git a/gradle.properties b/gradle.properties index 0ce008e..3c5c766 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,8 @@ -# Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true -# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349 org.gradle.configuration-cache=false -# Acknowledge using Groovy DSL with Stonecutter (Kotlin DSL is recommended but Groovy works). dev.kikugie.stonecutter.hard_mode=true # Single loom version covers all MC variants. The `fabric-loom-remap` plugin id diff --git a/launchtest/src/fallback/java/dsns/betterhud/gametest/LaunchTestClient.java b/launchtest/src/fallback/java/dsns/betterhud/gametest/LaunchTestClient.java index cb21937..ec45bd0 100644 --- a/launchtest/src/fallback/java/dsns/betterhud/gametest/LaunchTestClient.java +++ b/launchtest/src/fallback/java/dsns/betterhud/gametest/LaunchTestClient.java @@ -21,13 +21,10 @@ public class LaunchTestClient implements ClientModInitializer { private static final boolean EXPECT_WORLD = Boolean.getBoolean("betterhud.launchtest.expectWorld"); - // 200 ticks (10s) gives the software renderer on CI time to draw chunks. private static final int WORLD_SCREENSHOT_TICK = 200; private static final int WORLD_STOP_TICK = 240; private static final int TITLE_SCREENSHOT_TICK = 40; private static final int TITLE_STOP_TICK = 80; - // 2400 ticks (2min) is plenty to join the pre-generated flat world; bail - // out with a failure instead of hanging until the CI job timeout. private static final int WORLD_JOIN_TIMEOUT_TICKS = 2400; private int totalTicks; diff --git a/launchtest/src/gametest-legacy/java/dsns/betterhud/gametest/BetterHudClientGameTest.java b/launchtest/src/gametest-legacy/java/dsns/betterhud/gametest/BetterHudClientGameTest.java index 071f168..9702c2e 100644 --- a/launchtest/src/gametest-legacy/java/dsns/betterhud/gametest/BetterHudClientGameTest.java +++ b/launchtest/src/gametest-legacy/java/dsns/betterhud/gametest/BetterHudClientGameTest.java @@ -26,7 +26,6 @@ public void runTest(ClientGameTestContext context) { .create()) { singleplayer.getClientWorld().waitForChunksRender(); - // Let the world tick a little with the HUD rendering before capturing evidence. context.waitTicks(40); assertScreenshotSaved(context.takeScreenshot("betterhud-survival-world")); } diff --git a/settings.gradle b/settings.gradle index 9b53c5b..25cbeef 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,28 +21,16 @@ plugins { id 'dev.kikugie.stonecutter' version '0.9.3' } -// Every supported Minecraft version, and the build variant that covers it, -// lives in supported-versions.json — the single source of truth also used by -// the launch tests, the CI matrices, and the modrinthBundle task. def supportedVersions = new groovy.json.JsonSlurper().parse(file('supported-versions.json')) def variants = supportedVersions.values()*.variant.unique() stonecutter { create(rootProject) { - // Each variant is one buildable subproject; the string is both the - // subproject name and the MC version it compiles against (see - // versions//gradle.properties). versions(*variants) - - // vcsVersion is the variant whose form the sources are committed in - // (the "active" version when nothing else is selected). vcsVersion = variants.last() } } rootProject.name = 'betterhud' -// Not a Stonecutter variant: a sourceless harness that launches a production -// Fabric client for any supported MC version (-PtestMcVersion) with the -// matching variant's built jar. Used by the CI launch-test matrix. include 'launchtest' diff --git a/src/gametest/java/dsns/betterhud/gametest/BetterHudClientGameTest.java b/src/gametest/java/dsns/betterhud/gametest/BetterHudClientGameTest.java index 95c29ac..8057007 100644 --- a/src/gametest/java/dsns/betterhud/gametest/BetterHudClientGameTest.java +++ b/src/gametest/java/dsns/betterhud/gametest/BetterHudClientGameTest.java @@ -21,7 +21,6 @@ public void runTest(ClientGameTestContext context) { .create()) { singleplayer.getClientLevel().waitForChunksRender(); - // Let the world tick a little with the HUD rendering before capturing evidence. context.waitTicks(40); assertScreenshotSaved(context.takeScreenshot("betterhud-survival-world")); } diff --git a/src/main/java/dsns/betterhud/BetterHUD.java b/src/main/java/dsns/betterhud/BetterHUD.java index 39bd452..9d2ffeb 100644 --- a/src/main/java/dsns/betterhud/BetterHUD.java +++ b/src/main/java/dsns/betterhud/BetterHUD.java @@ -23,10 +23,6 @@ @Environment(EnvType.CLIENT) public class BetterHUD implements ClientModInitializer { - - // This logger is used to write text to the console and the log file. - // It is considered best practice to use your mod id as the logger's name. - // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LoggerFactory.getLogger("betterhud"); public static ArrayList mods = new ArrayList<>( diff --git a/src/main/java/dsns/betterhud/ModMenu.java b/src/main/java/dsns/betterhud/ModMenu.java index 70400af..2d9a843 100644 --- a/src/main/java/dsns/betterhud/ModMenu.java +++ b/src/main/java/dsns/betterhud/ModMenu.java @@ -24,7 +24,6 @@ public ConfigScreenFactory getModConfigScreenFactory() { .setParentScreen(parent) .setTitle(Component.literal("BetterHUD Settings")); - // same as builder.setSavingRunnable(() -> Config.serialize()); builder.setSavingRunnable(Config::serialize); ConfigEntryBuilder entryBuilder = builder.entryBuilder(); diff --git a/src/main/java/dsns/betterhud/mods/Biome.java b/src/main/java/dsns/betterhud/mods/Biome.java index e455125..b0874e4 100644 --- a/src/main/java/dsns/betterhud/mods/Biome.java +++ b/src/main/java/dsns/betterhud/mods/Biome.java @@ -36,8 +36,8 @@ public CustomText onStartTick(Minecraft client) { if (player == null) return null; - // have to specify this because name of class is Biome //? if >=26 { + // must use long type because name of class is Biome Holder biome = client.level.getBiome(player.blockPosition()); if (!biome.unwrapKey().isPresent()) return null; @@ -99,17 +99,14 @@ public CustomText onStartTick(Minecraft client) { } public String formatSnakeCase(String biomeName) { - // Split the string by underscores String[] words = biomeName.split("_"); - // Capitalize each word for (int i = 0; i < words.length; i++) { words[i] = words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase(); } - // Join the words with spaces return String.join(" ", words); } } diff --git a/src/main/java/dsns/betterhud/mods/Facing.java b/src/main/java/dsns/betterhud/mods/Facing.java index 9541993..92f342b 100644 --- a/src/main/java/dsns/betterhud/mods/Facing.java +++ b/src/main/java/dsns/betterhud/mods/Facing.java @@ -35,17 +35,14 @@ public CustomText onStartTick(Minecraft client) { } public String formatSnakeCase(String biomeName) { - // Split the string by underscores String[] words = biomeName.split("_"); - // Capitalize each word for (int i = 0; i < words.length; i++) { words[i] = words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase(); } - // Join the words with spaces return String.join(" ", words); } } diff --git a/stonecutter.gradle b/stonecutter.gradle index 755ca07..35d0f5c 100644 --- a/stonecutter.gradle +++ b/stonecutter.gradle @@ -2,26 +2,14 @@ plugins { id 'dev.kikugie.stonecutter' } -// The "active" version determines which variant the source tree currently shows -// uncommented. Switch with `./gradlew "Set active version to "` (Stonecutter task). stonecutter.active('26.2') /* [SC] DO NOT EDIT */ -// Stonecutter 0.7+ no longer needs explicit `registerChiseled` task: running -// `./gradlew build` from the root automatically runs `build` for every version -// subproject. Per-version commands like `./gradlew :1.21:build` also work. - -// Groups every supported Minecraft version (supported-versions.json) by the -// build variant whose jar covers it, e.g. '1.21' -> ['1.21', ..., '1.21.5']. def supportedVersions = new groovy.json.JsonSlurper().parse(file('supported-versions.json')) def gameVersionsByVariant = [:] supportedVersions.each { mc, info -> gameVersionsByVariant.computeIfAbsent(info.variant) { [] } << mc } -// Builds every variant and collects the release jars in build/modrinth/ along -// with UPLOAD.md, which lists exactly which Minecraft versions to select for -// each jar when uploading to Modrinth. CI publishes the same directory as the -// "modrinth-upload" artifact on every push. tasks.register('modrinthBundle') { group = 'publishing' description = 'Collects the release jars and the per-jar Minecraft version lists for Modrinth.' @@ -44,22 +32,6 @@ tasks.register('modrinthBundle') { rows << "| `${jar.name}` | ${gameVersions.join(', ')} |" } - def manifest = new File(outDir, 'UPLOAD.md') - manifest.text = [ - "# Modrinth upload — betterhud ${project.mod_version}", - '', - 'Upload each jar below as its own Modrinth version, selecting exactly', - 'the listed Minecraft versions for it. Loader: Fabric. Required', - 'dependencies: Fabric API, Cloth Config, Mod Menu.', - '', - '| File | Minecraft versions |', - '| --- | --- |', - *rows, - '' - ].join('\n') - - println() - println manifest.text println "Bundle written to ${outDir}" } } diff --git a/versions/1.21.6/gradle.properties b/versions/1.21.6/gradle.properties index e3951b0..a6cb6ef 100644 --- a/versions/1.21.6/gradle.properties +++ b/versions/1.21.6/gradle.properties @@ -2,12 +2,9 @@ minecraft_version=1.21.6 loader_version=0.17.3 java_version=21 -# fabric.mod.json range mc_dep=>=1.21.6 <1.22 loader_dep=>=0.16.10 -# Fabric API + ecosystem (compile-time versions for this variant; the launch -# tests pin per-version runtime versions in supported-versions.json). fabric_api_version=0.128.2+1.21.6 modmenu_version=15.0.2 cloth_config_version=19.0.147 diff --git a/versions/1.21/gradle.properties b/versions/1.21/gradle.properties index c84e2bf..ed95574 100644 --- a/versions/1.21/gradle.properties +++ b/versions/1.21/gradle.properties @@ -2,12 +2,9 @@ minecraft_version=1.21 loader_version=0.17.3 java_version=21 -# fabric.mod.json range mc_dep=>=1.21 <=1.21.5 loader_dep=>=0.15.11 -# Fabric API + ecosystem (compile-time versions for this variant; the launch -# tests pin per-version runtime versions in supported-versions.json). fabric_api_version=0.102.0+1.21 modmenu_version=14.0.2 cloth_config_version=19.0.147 diff --git a/versions/26.1/gradle.properties b/versions/26.1/gradle.properties index dfd7869..ce6fc20 100644 --- a/versions/26.1/gradle.properties +++ b/versions/26.1/gradle.properties @@ -2,11 +2,9 @@ minecraft_version=26.1 loader_version=0.19.2 java_version=25 -# fabric.mod.json range mc_dep=>=26.1 <26.2 loader_dep=>=0.19 -# Fabric API + ecosystem (runtime deps, not bundled) fabric_api_version=0.145.1+26.1 modmenu_version=18.0.0-alpha.8 cloth_config_version=26.1.154 diff --git a/versions/26.2/gradle.properties b/versions/26.2/gradle.properties index d5bee7a..0bb6973 100644 --- a/versions/26.2/gradle.properties +++ b/versions/26.2/gradle.properties @@ -2,11 +2,9 @@ minecraft_version=26.2 loader_version=0.19.3 java_version=25 -# fabric.mod.json range mc_dep=>=26.2 loader_dep=>=0.19 -# Fabric API + ecosystem (26.2 requires these as runtime deps, not bundled) fabric_api_version=0.154.0+26.2 modmenu_version=18.0.0-alpha.8 cloth_config_version=26.1.154