diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5109f30..4939064a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,16 @@ -name: Modern Metals 1.13.2 CI +name: Modern Metals 1.14.4 CI on: push: - branches: [master-1.13.2, 'feature/**'] + branches: [master-1.14.4, 'feature/**'] pull_request: - branches: [master-1.13.2] + branches: [master-1.14.4] permissions: contents: read concurrency: - group: modernmetals-113-${{ github.workflow }}-${{ github.ref }} + group: modernmetals-114-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -41,10 +41,10 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 - name: Stage checksum-verified published dependencies - run: bash gradle/stage-orespawn-release.sh .gradle/release-dependencies + run: bash gradle/stage-release-dependencies.sh .gradle/release-dependencies - name: Build, audit and generate Eclipse launches run: | - bash ./gradlew clean check build javadoc verify113ReleaseArtifacts write113ReleaseChecksums genEclipseRuns eclipse \ + bash ./gradlew clean check build javadoc verify114ReleaseArtifacts write114ReleaseChecksums genEclipseRuns eclipse \ -PreleaseBuild=true -PdependencyMirror="$PWD/.gradle/release-dependencies" \ --no-daemon --stacktrace --max-workers=2 \ "-Dorg.gradle.java.installations.paths=$JAVA_HOME,$JAVA_HOME_8_X64,$JAVA_HOME_25_X64" \ @@ -57,7 +57,7 @@ jobs: - name: Upload audited release candidate uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: ModernMetals-1.13.2-${{ github.sha }} + name: ModernMetals-1.14.4-${{ github.sha }} if-no-files-found: error retention-days: 30 path: build/release-bundle/ @@ -65,7 +65,7 @@ jobs: if: failure() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: ModernMetals-1.13.2-diagnostics-${{ github.sha }} + name: ModernMetals-1.14.4-diagnostics-${{ github.sha }} if-no-files-found: ignore retention-days: 14 path: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 595d198e..c3b02b39 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,11 +3,11 @@ name: CodeQL on: push: branches: - - master-1.13.2 + - master-1.14.4 - 'feature/**' pull_request: branches: - - master-1.13.2 + - master-1.14.4 schedule: - cron: '47 7 * * 4' @@ -58,7 +58,7 @@ jobs: run: | set -euo pipefail mirror="$RUNNER_TEMP/legacy-dependency-mirror" - bash gradle/stage-orespawn-release.sh "$mirror" + bash gradle/stage-release-dependencies.sh "$mirror" echo "repository=$mirror" >> "$GITHUB_OUTPUT" - name: Compile production code diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index db953724..b8204cba 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,15 +1,15 @@ -name: Release Modern Metals 1.13.2 +name: Release Modern Metals 1.14.4 run-name: Modern Metals ${{ inputs.release_version }} (${{ inputs.confirm_live_publication && 'publish' || 'verify' }}) on: workflow_dispatch: inputs: release_version: - description: Four-part version for Minecraft 1.13.2 + description: Four-part version for Minecraft 1.14.4 required: true type: string release_commit: - description: Full SHA of the checked MMD master-1.13.2 commit + description: Full SHA of the checked MMD master-1.14.4 commit required: true type: string tested_jar_sha256: @@ -33,13 +33,13 @@ permissions: contents: read concurrency: - group: modernmetals-release-113 + group: modernmetals-release-114 cancel-in-progress: false jobs: qualify: name: Verify merged CI candidate - if: github.repository == 'MinecraftModDevelopmentMods/ModernMetals' && github.ref == 'refs/heads/master-1.13.2' + if: github.repository == 'MinecraftModDevelopmentMods/ModernMetals' && github.ref == 'refs/heads/master-1.14.4' runs-on: ubuntu-latest timeout-minutes: 10 permissions: @@ -61,21 +61,21 @@ jobs: TESTED_SHA: ${{ inputs.tested_jar_sha256 }} run: | set -euo pipefail - [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.113021$ ]] + [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.114041$ ]] [[ "$RELEASE_SHA" =~ ^[[:xdigit:]]{40}$ ]] [[ "$TESTED_SHA" =~ ^[[:xdigit:]]{64}$ ]] test "$(git rev-parse HEAD)" = "$RELEASE_SHA" - test "$(gh api "repos/$GITHUB_REPOSITORY/branches/master-1.13.2" --jq .commit.sha)" = "$RELEASE_SHA" + test "$(gh api "repos/$GITHUB_REPOSITORY/branches/master-1.14.4" --jq .commit.sha)" = "$RELEASE_SHA" grep -Fxq "mod_version=$RELEASE_VERSION" gradle.properties - grep -Fxq 'minecraft_version=1.13.2' gradle.properties + grep -Fxq 'minecraft_version=1.14.4' gradle.properties ci_run="$(gh api --method GET "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs" \ - -f branch=master-1.13.2 -f head_sha="$RELEASE_SHA" -f event=push -f status=success \ + -f branch=master-1.14.4 -f head_sha="$RELEASE_SHA" -f event=push -f status=success \ --jq '.workflow_runs[0].id // empty')" test -n "$ci_run" echo "ci_run=$ci_run" >> "$GITHUB_OUTPUT" - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: ModernMetals-1.13.2-${{ inputs.release_commit }} + name: ModernMetals-1.14.4-${{ inputs.release_commit }} run-id: ${{ steps.candidate.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -152,12 +152,12 @@ jobs: - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: ModernMetals-1.13.2-${{ inputs.release_commit }} + name: ModernMetals-1.14.4-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input - name: Stage checksum-verified published dependencies - run: bash gradle/stage-orespawn-release.sh .gradle/release-dependencies + run: bash gradle/stage-release-dependencies.sh .gradle/release-dependencies - name: Publish the sealed Maven jars env: MAVEN_UPLOAD_URL: ${{ secrets.MAVEN_UPLOAD_URL }} @@ -179,7 +179,7 @@ jobs: steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: ModernMetals-1.13.2-${{ inputs.release_commit }} + name: ModernMetals-1.14.4-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -187,16 +187,17 @@ jobs: working-directory: ${{ runner.temp }}/release-input run: sha256sum --check --strict SHA256SUMS - name: Publish Modern Metals + id: curseforge uses: Kira-NT/mc-publish@52307b03863581dec6b652b83e597aec02ebb075 # v3.3.1 with: curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} curseforge-id: '244357' - name: Modern Metals ${{ inputs.release_version }} for Minecraft 1.13.2 (Forge) + name: Modern Metals ${{ inputs.release_version }} for Minecraft 1.14.4 (Forge) version: ${{ inputs.release_version }} version-type: ${{ inputs.curseforge_release_level }} changelog-file: ${{ runner.temp }}/release-input/CHANGELOG.txt loaders: forge - game-versions: '1.13.2' + game-versions: '1.14.4' game-version-filter: none environment: client | server java: Java 8 @@ -209,6 +210,16 @@ jobs: ${{ runner.temp }}/release-input/ModernMetals-${{ inputs.release_version }}-sources.jar ${{ runner.temp }}/release-input/ModernMetals-${{ inputs.release_version }}-javadoc.jar + - name: Record the accepted CurseForge files + env: + CURSEFORGE_URL: ${{ steps.curseforge.outputs.curseforge-url }} + CURSEFORGE_FILES: ${{ steps.curseforge.outputs.curseforge-files }} + run: | + python3 - <<'PY' + import json, os + print(json.dumps({'url': os.environ['CURSEFORGE_URL'], 'files': os.environ['CURSEFORGE_FILES']})) + PY + publish_github: name: Publish GitHub Release needs: [qualify, publish_curseforge] @@ -221,7 +232,7 @@ jobs: steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: ModernMetals-1.13.2-${{ inputs.release_commit }} + name: ModernMetals-1.14.4-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -234,5 +245,5 @@ jobs: set -euo pipefail sha256sum --check --strict SHA256SUMS gh release create "$RELEASE_VERSION" --repo "$GITHUB_REPOSITORY" --verify-tag \ - --title "Modern Metals $RELEASE_VERSION for Minecraft 1.13.2 (Forge)" \ + --title "Modern Metals $RELEASE_VERSION for Minecraft 1.14.4 (Forge)" \ --notes-file CHANGELOG.txt "ModernMetals-$RELEASE_VERSION"{,-sources,-javadoc}.jar SHA256SUMS diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index e57126f2..b96a4edf 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -1,7 +1,7 @@ -name: Validate Modern Metals 1.13.2 tag +name: Validate Modern Metals 1.14.4 tag on: push: - tags: ['*.*.*.113021'] + tags: ['*.*.*.114041'] permissions: contents: read actions: read @@ -16,5 +16,5 @@ jobs: run: | set -euo pipefail test "$GITHUB_REF_NAME" = "$(sed -n 's/^mod_version=//p' gradle.properties)" - grep -Fxq 'minecraft_version=1.13.2' gradle.properties + grep -Fxq 'minecraft_version=1.14.4' gradle.properties echo 'Tag validated. Publication uses deploy-release.yml with explicit confirmation.' >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/validate-gradle-build.yml b/.github/workflows/validate-gradle-build.yml index d4d55ba3..c471b098 100644 --- a/.github/workflows/validate-gradle-build.yml +++ b/.github/workflows/validate-gradle-build.yml @@ -3,11 +3,11 @@ name: Validate Gradle Wrapper on: push: branches: - - master-1.13.2 + - master-1.14.4 - 'feature/**' pull_request: branches: - - master-1.13.2 + - master-1.14.4 permissions: contents: read diff --git a/.gitignore b/.gitignore index 3a14b223..884b2581 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ run /forge-*-changelog.txt secret.json +/local-basemetals.json +/local-sibling-mods.json # Local context and generated verification /AGENTS.md /agent-notes/ diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a7d92c68..8580cd88 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,20 @@ +3.0.0.114041 for Minecraft 1.14.4 + +- Fixed overlapping bars for every material, including titanium. +- Added a hash-pinned local Base Metals option for combined Eclipse testing. +- Added all eight Eclipse test combinations with Base Metals, Base Gems and Base Minerals, each with its own saves and config. +- Check the exact sibling jars in each profile so a Gradle refresh cannot quietly mix local builds or load an unwanted companion. + + +- Ported Modern Metals to Forge 28 and pinned the published OreSpawn 4.1.7.114041 release. +- Kept all 21 materials, the reviewed mining levels, alloy formulas and recipe discovery from 1.13.2. +- Added native block loot and blast-furnace processing, including small powders and small blends. +- Rods now craft in fours, gears in fours and plates in threes. Recycling follows the actual material cost. +- Moved molten metal to Forge's fluid attributes and kept contact damage, animated textures and coloured buckets. +- Updated smith trades for the new villager professions. +- Kept both config entry points, Fantasy Level inheritance and the Base Metals crushing handoff. +- Kept legacy world conversion and saved registry IDs. Always test upgrades on a copy. + 3.0.0.113021 for 1.13.2 - Use Base Metals 3.0.3 or later when installed together, with its shared processing and mining fixes. diff --git a/README.md b/README.md index c3843599..b9d82033 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Modern Metals for Minecraft 1.13.2 +# Modern Metals for Minecraft 1.14.4 Modern Metals adds 21 metals and alloys, including boron, beryllium, thorium and titanium. Crush and smelt ores, blend alloys, or make tools, armour and @@ -6,107 +6,125 @@ building blocks. ## Installation -Use Java 8 and Forge **25.0.223** for Minecraft **1.13.2**. Install Modern -Metals and [OreSpawn 4.1.7.113021](https://www.curseforge.com/minecraft/mc-mods/mmd-orespawn/files/9611746) -on both the client and server. [Base Metals 3.0.3.113021](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.0.3.113021) -is optional for new worlds. Its powders supply the ingredients for several -alloys, and its crusher recipes work alongside Modern Metals recipes. +Use Java 8 and Forge **28.2.26** for Minecraft **1.14.4**. Install Modern +Metals and [OreSpawn 4.1.7.114041](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.114041) +on both the client and server. [Base Metals 3.0.2.114041](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.0.2.114041) +is optional. Its copper, steel, zinc and nickel powders supply ingredients +for several alloys. Modern Metals contributes its crushing recipes to Base +Metals when both are installed. -Use Base Metals 3.0.3.113021 or a later compatible 1.13.2 build when installing -the two together. That release includes the shared processing and mining fixes. - -OreSpawn places the ores. Titanium ore is off by default. You can still make -titanium from rutile and magnesium. Existing chunks keep their ores. +OreSpawn places the ores. Titanium ore is off by default; rutile and magnesium +still make titanium. Retrogen is off. This version follows vanilla 1.14 +mining: pickaxes drop ore blocks, and crackhammers produce powders. Open **Mods → Modern Metals → Config**, or choose Modern Metals from the OreSpawn settings screen. High Fantasy allows the full set of recipes. Low Fantasy restricts equipment and decorative recipes by material. Modern -Metals uses Base Metals' setting when Base Metals is installed. Restart the -game or server after changing Fantasy Level, and use the same mode on both -ends of a multiplayer connection. +Metals uses Base Metals' setting when Base Metals is installed. Restart after +changing Fantasy Level and use the same mode on the client and server. -## Processing and recipe discovery +## Processing and discovery Pick up a material to discover its crafting recipes. Powders, small powders -and blends reveal their processing recipes, including entries in the furnace -book. Existing inventories are checked when joining a world and after a data -pack reload. +and blends also reveal their furnace and blast-furnace recipes. Existing +inventories are checked on login and after a data pack reload. -Nine coal dust make a vanilla coal block, which you can craft back into nine -coal. Crackhammers also crush coal and coal blocks. Base Metals supplies those -shared recipes when installed. +Nine coal dust make a vanilla coal block, which crafts back into nine coal. +Crackhammers also crush coal and coal blocks. Base Metals owns these shared +recipes when installed. -Galvanized steel and stainless steel accept steel blend directly in place of -steel dust. One whole blend replaces one dust, keeping the usual output. +Galvanized steel and stainless steel accept steel blend directly in place +of steel dust. One whole blend replaces one dust, keeping the usual output. +The five alloy formulas and their yields are unchanged. -Small powders and small blends smelt into nuggets. Metal blocks crush into -nine powders. You can recycle equipment and components in a furnace, and -repair armour and shields with a matching plate. Named and enchanted equipment -keeps its saved data when repaired. +Component recipes give four rods, four gears or three plates. Recycling +follows those crafting quantities, rounding down where a fraction cannot be +returned. Small powders and small blends smelt into nuggets; metal blocks +crush into nine powders. Armour and shields can be repaired with a matching +plate while keeping names, enchantments and other saved data. -See [processing and alloy recipes](docs/PROCESSING.md) for the five blend -formulas and the forms retained for optional integrations. +See [processing and alloy recipes](docs/PROCESSING.md) and the +[material mining audit](docs/MINING_LEVELS.md). Galvanized steel, stainless +steel and titanium keep iron-level mining. Molten metal burns on contact. ## Crushing recipes for add-ons -Crackhammers need the same mining level as a pickaxe. Galvanized steel, -stainless steel and titanium have iron-level mining and can mine Base Gems' -jasper. Ores and storage blocks in the shared Forge block tags -use the normal hammer mining speed when the hammer is strong enough. - -[The material audit](docs/MINING_LEVELS.md) lists the reviewed tool, solid-metal -and ore requirements for every metal. Tool capability accounts for material -type rather than treating one hardness score as a complete tool specification. -New smith offers also follow the reviewed tiers through the existing pricing formula. - -On 1.13.2, a mod or data pack can add a recipe under its own -`data//recipes/` directory with type `modernmetals:crushing`. -Use a Minecraft `ingredient` and a `result` object with the output `item` -and `count`, just as with `basemetals:crushing`. If Modern Metals is optional, -use a `forge:mod_loaded` condition for `modernmetals`. - -Read the recipes from the world's recipe manager. With Modern Metals alone -they use `CrushingRecipe.TYPE`. With Base Metals installed they keep their -recipe IDs and use the Base Metals type, so Base Metals tools and crushers -can find them too. - -## Upgrading a world - -Keep the original world intact and open a separate copy in 1.13.2. Keep the -original Forge registry data in `level.dat`. Minecraft 1.13.2 uses block -states and named item IDs, so the migration needs the old world’s saved -numeric IDs to find the right blocks. Install compatible 1.13.2 versions of -the other mods that supplied blocks or items to the world. -[World migration](docs/MIGRATION.md) - -## Building - -Gradle uses Java 17, Mavenizer uses Java 25, and the mod compiles and runs -on Java 8. Run `gradlew build genEclipseRuns eclipse` from this checkout. -The build checks the OreSpawn jar against the published SHA-256. To stage a -local copy, run `bash gradle/stage-orespawn-release.sh ` and pass -`-PdependencyMirror=` to Gradle. - -In Eclipse, use **Gradle → Refresh Gradle Project** to rebuild the -development output and regenerate the launches. Run `runClient.launch` -from the project. - -To test add-ons from Eclipse, stage their 1.13.2 `*-deobf.jar` files from -`build/libs-dev` in `run/compatibility-jars` as `basemetals-dev.jar`, -`basegems-dev.jar` and `baseminerals-dev.jar`. Run -`gradlew prepareCompatibilityLaunches` or refresh the Gradle project once -the jars are staged. In **Run → Run Configurations → Java Application**, -choose a **Modern Metals - …** launch. Each combination has its own saves, -config and mods in `run/compatibility`. - -For a local OreSpawn fix, stage its published-format jar as -`run/compatibility-jars/orespawn-development.jar` and put its SHA-256 in -`orespawn-development.sha256` alongside it. Enable `-PuseDevelopmentOreSpawn=true` -when generating the client, server and combination launches. The development engine must -keep the pinned version and public API. Compilation and release dependency -checks use the published jar. Normal launches use the published runtime even -if the old local files are still present. - -The [changelog](CHANGELOG.txt) and [migration checks](docs/MIGRATION.md) -cover the differences from 1.12.2. The port uses artwork and code from -Modern Metals and the Forge 25 Base Metals port. See [artwork credits](LICENSE-ART.txt). +Add a recipe under `data//recipes/` with type +`modernmetals:crushing`, a Minecraft `ingredient`, and a `result` object +containing `item` and `count`. If Modern Metals is optional, use a +`forge:mod_loaded` condition. + +Read loaded recipes from the world's recipe manager. Standalone recipes use +`CrushingRecipe.TYPE`. With Base Metals installed, they keep their IDs and +use `basemetals:crushing`, so its tools and machines can find them too. + +## Existing worlds + +Open a complete copy of the world and keep the original outside the test +instance. Install compatible versions of every mod that supplied saved +blocks or items. Do not remove an old world's Forge registry snapshot. +See [world migration](docs/MIGRATION.md) for the legacy numeric conversion +and the [1.14 port notes](docs/PORTING_114.md) for the port's checks. + +## Building and Eclipse + +Gradle uses Java 17, Mavenizer uses Java 25, and compilation and Minecraft use +Java 8. Node.js runs the data generators and resource checks. + +Run `gradlew build verify114ReleaseArtifacts genEclipseRuns eclipse`. +The build verifies the published OreSpawn jar's SHA-256. Eclipse's compatibility +profiles also verify the sibling jars before staging their mapped versions. + +Import this inner project into its own Eclipse workspace, then use +**Gradle → Refresh Gradle Project**. With the local sibling pins set up below, +Run Configurations lists eight clients under **Modern Metals - …**: + +- Standalone +- Base Metals +- Base Gems +- Base Minerals +- Base Metals + Base Gems +- Base Metals + Base Minerals +- Base Gems + Base Minerals +- All Add-ons + +Each includes Modern Metals and the published OreSpawn dependency. The label +lists the additional mods. Each combination has its own saves and config. +Standalone keeps the existing `run` folder; Base Metals keeps +`run/with-basemetals`. The other six use separate folders under +`run/compatibility`. The older `runClient.launch` and +`runClientWithBaseMetals.launch` names still work. + +Automated probe launches use disposable saves and exit when finished. They +are separate from the manual profiles and are excluded from the player, +source and Javadoc jars. + +See the +[changelog](CHANGELOG.txt) and [artwork credits](LICENSE-ART.txt). + +## Testing a local Base Metals candidate + +Build the sibling Base Metals 1.14 checkout, then run +`gradlew pinLocalBaseMetals` here, followed by `gradlew eclipse`. The ignored +`local-basemetals.json` records the exact player and mapped jar hashes. +`runClientWithBaseMetals.launch` then uses that candidate; the standalone +profile still runs without Base Metals. A Gradle refresh keeps the local pin. + +After rebuilding Base Metals, run the pin task again. A stale hash stops the +profile refresh. Use `-PuseLocalBaseMetals=false` to test the published jar. +Release builds use published dependencies. + +For Base Gems and Base Minerals, build their sibling 1.14 checkouts first, then +run `gradlew pinLocalSiblingMods` here. Run `gradlew eclipse` as a separate +command afterwards. The ignored `local-sibling-mods.json` records both jars' +paths and hashes for each mod. Regenerate these pins after rebuilding either +sibling; a stale hash stops the refresh. Without local sibling pins, a clean +checkout generates the original standalone and Base Metals profiles. + +Profile refreshes check the exact sibling selection and preserve saves, +config and unrelated mods. Replaced sibling jars are retained under +`.gradle/retired-compatibility-jars`. `gradlew verifyCompatibilityLaunches` +checks the generated profiles and staged hashes. + +Bars now use vanilla connection geometry for all materials. The ore overlays +keep the 0.05 pixel separation used by the later fixes. diff --git a/build.gradle b/build.gradle index 8fb0031c..df196dee 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ import groovy.xml.XmlParser import groovy.xml.XmlUtil +import org.apache.tools.ant.filters.FixCrLfFilter plugins { id 'java' @@ -19,6 +20,35 @@ java { withJavadocJar() } +sourceSets { + clientIntegrationTest { + compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath + runtimeClasspath += sourceSets.main.output + sourceSets.main.runtimeClasspath + } + integrationTest { + compileClasspath += sourceSets.main.output + sourceSets.main.compileClasspath + runtimeClasspath += sourceSets.main.output + sourceSets.main.runtimeClasspath + } +} +configurations { + clientIntegrationTestImplementation.extendsFrom implementation + clientIntegrationTestRuntimeOnly.extendsFrom runtimeOnly + integrationTestImplementation.extendsFrom implementation + integrationTestRuntimeOnly.extendsFrom runtimeOnly +} +def probeClasses = layout.buildDirectory.dir('forge-run-mod-classes/probe') +def clientProbeClasses = layout.buildDirectory.dir('forge-run-mod-classes/client-probe') +def prepareClientProbeClasses = tasks.register('prepareClientProbeClasses', Sync) { + dependsOn 'clientIntegrationTestClasses' + from sourceSets.clientIntegrationTest.output + into clientProbeClasses +} +def prepareProbeClasses = tasks.register('prepareProbeClasses', Sync) { + dependsOn 'integrationTestClasses' + from sourceSets.integrationTest.output + into probeClasses +} + tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } def compileMiningLevelChecks = tasks.register('compileMiningLevelChecks', JavaCompile) { @@ -43,6 +73,10 @@ tasks.withType(Javadoc).configureEach { tasks.withType(AbstractArchiveTask).configureEach { preserveFileTimestamps = false reproducibleFileOrder = true + filteringCharset = 'UTF-8' + filesMatching(['**/*.java', '**/*.json', '**/*.toml', '**/*.mcmeta', '**/*.md', '**/*.txt']) { + filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('lf')) + } } def runClasses = layout.buildDirectory.dir('forge-run-mod-classes/main') @@ -59,7 +93,7 @@ minecraft { mainClass = 'net.minecraftforge.userdev.LaunchTesting' workingDir.convention layout.projectDirectory.dir('run') mods { modernmetals { source sourceSets.main } } - environment 'target', 'fmluserdev' + name + environment 'target', name.toLowerCase().contains('client') ? 'fmluserdevclient' : 'fmluserdevserver' environment 'MCP_MAPPINGS', "${mapping_channel}_${mapping_version}" environment 'MCP_VERSION', mcp_version environment 'FORGE_VERSION', forge_version @@ -70,25 +104,95 @@ minecraft { } register('client') register('server') { args '--nogui' } + register('probeClient') { + workingDir.convention layout.projectDirectory.dir(providers.gradleProperty('probeClientDirectory').orElse('run/verification/client').get()) + mods { modernmetalsclientprobe { source sourceSets.clientIntegrationTest } } + systemProperty 'modernmetalsclientprobe.expectBase', providers.gradleProperty('probeExpectBaseMetals') + .orElse(providers.gradleProperty('withBaseMetals').orElse('false')).get() + def mainOutput = runClasses.get().asFile.absolutePath + def probeOutput = clientProbeClasses.get().asFile.absolutePath + environment 'MOD_CLASSES', "modernmetals%%${mainOutput}${File.pathSeparator}modernmetals%%${mainOutput}${File.pathSeparator}modernmetalsclientprobe%%${probeOutput}${File.pathSeparator}modernmetalsclientprobe%%${probeOutput}" + } + register('runtimeProbeServer') { + workingDir.convention layout.projectDirectory.dir(providers.gradleProperty('probeDirectory').orElse('run/verification/standalone-high').get()) + mods { modernmetalsprobe { source sourceSets.integrationTest } } + def mainOutput = runClasses.get().asFile.absolutePath + def probeOutput = probeClasses.get().asFile.absolutePath + environment 'MOD_CLASSES', "modernmetals%%${mainOutput}${File.pathSeparator}modernmetals%%${mainOutput}${File.pathSeparator}modernmetalsprobe%%${probeOutput}${File.pathSeparator}modernmetalsprobe%%${probeOutput}" + args '--nogui' + systemProperty 'modernmetalsprobe.titanium', providers.gradleProperty('probeTitanium').orElse('false').get() + if (providers.gradleProperty('probeWorldUpgrade').orElse('false').get().toBoolean()) { + systemProperty 'modernmetalsprobe.upgrade', 'true' + args '--forceUpgrade' + } + } } } tasks.withType(JavaExec).configureEach { - if (name in ['runClient', 'runServer']) { + if (name in ['runClient', 'runServer', 'runRuntimeProbeServer', 'runProbeClient']) { dependsOn prepareRunClasses javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(8) } doFirst { new File(workingDir, 'mods').mkdirs() } } + if (name == 'runRuntimeProbeServer') dependsOn prepareProbeClasses + if (name == 'runProbeClient') dependsOn prepareClientProbeClasses + if (name in ['runRuntimeProbeServer', 'runProbeClient']) { + String receiptName = name == 'runProbeClient' ? 'client-probe.json' : 'modernmetals-probe.json' + doFirst { + // ForgeGradle sets JavaExec's workingDir in its own later action. + // Validate and prepare the declared run directory before that happens. + boolean clientProbe = name == 'runProbeClient' + File runDirectory = file(providers.gradleProperty(clientProbe ? 'probeClientDirectory' : 'probeDirectory') + .orElse(clientProbe ? 'run/verification/client' : 'run/verification/standalone-high').get()).canonicalFile + if (!runDirectory.toPath().startsWith(file('run/verification').canonicalFile.toPath()) + && !runDirectory.toPath().startsWith(layout.buildDirectory.get().asFile.canonicalFile.toPath()) + && !new File(runDirectory, '.modernmetals-disposable-test').isFile()) + throw new GradleException("Probe runs require a disposable test directory: ${runDirectory}; expected under ${file('run/verification').canonicalFile}") + runDirectory.mkdirs() + workingDir runDirectory + if (name == 'runRuntimeProbeServer') { + File eula = new File(runDirectory, 'eula.txt') + if (!eula.exists()) eula.text = 'eula=true\n' + File settings = new File(runDirectory, 'server.properties') + if (!settings.exists()) settings.text = 'online-mode=false\nserver-port=0\nview-distance=2\nspawn-protection=0\nmax-tick-time=0\nlevel-seed=14162026\n' + } + File receipt = new File(workingDir, receiptName) + if (receipt.exists()) { + java.nio.file.Files.move(receipt.toPath(), new File(workingDir, + receiptName + '.' + System.currentTimeMillis() + '.previous').toPath()) + } + } + doLast { + File receipt = new File(workingDir, receiptName) + if (!receipt.isFile() || new groovy.json.JsonSlurper().parse(receipt).status != 'passed') { + throw new GradleException("Native test failed; see ${receipt}") + } + if (name == 'runProbeClient') { + def errors = new File(workingDir, 'logs/latest.log').readLines('UTF-8').findAll { line -> + (line.contains('/ERROR]') || line.contains('/FATAL]')) && + !(line.contains('IndexedMessageCodec') && line.contains('Received empty payload on channel fml:handshake')) && + !(line.contains('ForgeConfig/CORE') && line.contains('Forge config just got changed on the file system!')) + } + if (!errors.isEmpty()) throw new GradleException("Unexpected client errors: ${errors.take(3)}") + } + } + } } // ForgeGradle writes Slime Launcher's paths as bare Eclipse program arguments. def eclipseLauncherPath = ~/(--(?:cache|metadata|to-srg|to-obf) )("[^"]*"|.+?)(?= (?:--metadata |--to-srg |--to-obf |--(?: |$)))/ tasks.matching { it.name.startsWith('genEclipseRun') && it.name.endsWith('ForForge') }.configureEach { dependsOn prepareRunClasses + dependsOn { configurations.baseMetalsDevelopment } String launchName = name.replaceFirst('^genEclipseRun', 'run').replaceFirst('ForForge$', '') + '.launch' File launch = layout.projectDirectory.file(launchName).asFile doLast { Node configuration = new XmlParser().parse(launch) + if (launchName in ['runClient.launch', 'runServer.launch']) { + new Node(configuration, 'booleanAttribute', + [key: 'org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE', value: 'true']) + } Node programArguments = configuration.stringAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS' } @@ -105,20 +209,51 @@ tasks.matching { it.name.startsWith('genEclipseRun') && it.name.endsWith('ForFor eclipse { synchronizationTasks 'genEclipseRuns' + classpath.file.whenMerged { classpath -> + classpath.entries.findAll { entry -> + entry.path?.startsWith('src/integrationTest/') || entry.path?.startsWith('src/clientIntegrationTest/') + }.each { entry -> entry.entryAttributes['test'] = 'true' } + } } +tasks.register('configureEclipseBuildship') { + doLast { + File target = file('.settings/org.eclipse.buildship.core.prefs') + target.parentFile.mkdirs() + Properties preferences = new Properties() + ['eclipse.preferences.version': '1', 'connection.gradle.distribution': 'GRADLE_DISTRIBUTION(WRAPPER)', + 'connection.gradle.user.home': gradle.gradleUserHomeDir.canonicalPath, + 'connection.project.dir': '', 'gradle.user.home': gradle.gradleUserHomeDir.canonicalPath, + 'java.home': new File(System.getProperty('java.home')).canonicalPath, + 'override.workspace.settings': 'true'].each { key, value -> preferences.setProperty(key, value) } + target.withOutputStream { preferences.store(it, 'Generated Modern Metals Buildship settings') } + } +} +tasks.named('genEclipseRuns') { dependsOn 'configureEclipseBuildship' } + tasks.named('eclipse') { dependsOn 'genEclipseRuns' } -apply from: 'gradle/eclipse-compatibility.gradle' +// Compatibility profiles are generated for available 1.14 add-ons only. -def oreSpawnModule = 'mmd-orespawn-245586' -def oreSpawnCoordinate = "curse.maven:${oreSpawnModule}:${orespawn_curse_file}" -def dependencyMirror = providers.gradleProperty('dependencyMirror').orElse('https://www.cursemaven.com') +def baseMetalsModule = 'BaseMetals' +def baseMetalsCoordinate = "zone.moddev.mc.basemetals:${baseMetalsModule}:${basemetals_version}" +def withBaseMetals = providers.gradleProperty('withBaseMetals').map { it.toBoolean() }.orElse(false) +def localBasePinFile = file('local-basemetals.json') +def releaseBuild = providers.gradleProperty('releaseBuild').map { it.toBoolean() }.orElse(false).get() +def useLocalBaseMetals = providers.gradleProperty('useLocalBaseMetals') + .map { it.toBoolean() }.orElse(localBasePinFile.isFile() && !releaseBuild).get() +if (useLocalBaseMetals && releaseBuild) throw new GradleException('Release builds must use published Base Metals') +def localBasePin = useLocalBaseMetals && localBasePinFile.isFile() + ? new groovy.json.JsonSlurper().parse(localBasePinFile) : [:] +if (useLocalBaseMetals && localBasePin.isEmpty()) throw new GradleException('Run pinLocalBaseMetals first') +def oreSpawnCoordinate = "zone.moddev.mc.orespawn:OreSpawn:${orespawn_version}" +def dependencyMirror = providers.gradleProperty('dependencyMirror').orElse('https://maven.moddev.zone/releases') repositories { minecraft.mavenizer(it) maven fg.forgeMaven maven fg.minecraftLibsMaven mavenCentral() + maven { url = uri("https://maven.moddev.zone/releases") } maven { url = 'https://libraries.minecraft.net/' } exclusiveContent { forRepository { maven { url = 'https://repo.spongepowered.org/repository/maven-public' } } @@ -131,18 +266,24 @@ repositories { metadataSources { artifact() } } } - filter { includeModule('curse.maven', oreSpawnModule) } + filter { includeModule('zone.moddev.mc.basemetals', baseMetalsModule) } } } configurations { oreSpawnRelease + baseMetalsRelease + baseMetalsDevelopment } +def mappedBaseMetals = useLocalBaseMetals ? files(file(localBasePin.mappedJar)) : renamer.dependency(baseMetalsCoordinate) dependencies { implementation minecraft.dependency("net.minecraftforge:forge:${minecraft_version}-${forge_version}") implementation renamer.dependency(oreSpawnCoordinate) oreSpawnRelease oreSpawnCoordinate + baseMetalsRelease baseMetalsCoordinate + baseMetalsDevelopment mappedBaseMetals + if (withBaseMetals.get()) runtimeOnly mappedBaseMetals } renamer.mappings.from minecraft.dependency.toSrgFile @@ -159,19 +300,139 @@ tasks.register('verifyReleaseDependencies') { } } if (digest.digest().encodeHex().toString() != orespawn_sha256) { - throw new GradleException('OreSpawn 1.13.2 release checksum mismatch') + throw new GradleException('OreSpawn 1.14.4 release checksum mismatch') + } + } +} + +def baseJarHash = { File jar -> java.security.MessageDigest.getInstance('SHA-256').digest(jar.bytes).encodeHex().toString() } +tasks.register('pinLocalBaseMetals') { + group = 'development' + description = 'Pins already-built sibling Base Metals jars for local testing.' + doLast { + File checkout = file(providers.gradleProperty('baseMetalsCheckout').orElse('../../BaseMetals 114/BaseMetals').get()).canonicalFile + def pins = [version: basemetals_version.toString()] + ['publishedJar': "build/libs/BaseMetals-${basemetals_version}.jar", + 'mappedJar': "build/libs-dev/BaseMetals-${basemetals_version}-deobf.jar"].each { key, path -> + File jar = new File(checkout, path) + if (!jar.isFile()) throw new GradleException("Build Base Metals first: ${jar}") + pins[key] = jar.canonicalPath + pins[key + 'Sha256'] = baseJarHash(jar) + } + localBasePinFile.setText(groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(pins)) + '\n', 'UTF-8') + } +} +def verifyLocalBase = tasks.register('verifyLocalBaseMetals') { + group = 'verification' + doLast { + if (!useLocalBaseMetals) return + if (localBasePin.version != basemetals_version.toString()) throw new GradleException('Local Base Metals version mismatch') + ['publishedJar', 'mappedJar'].each { key -> + File jar = file(localBasePin[key]) + if (!jar.isFile() || baseJarHash(jar) != localBasePin[key + 'Sha256']) + throw new GradleException("Local Base Metals changed. Rebuild, then run pinLocalBaseMetals: ${jar}") + } + } +} +tasks.withType(JavaExec).configureEach { + if (name in ['runClient', 'runServer', 'runProbeClient', 'runRuntimeProbeServer'] && withBaseMetals.get()) + dependsOn verifyLocalBase +} +tasks.register('prepareBaseMetalsProfile', Copy) { + dependsOn verifyLocalBase + from configurations.baseMetalsDevelopment + into layout.projectDirectory.dir('run/with-basemetals/mods') + rename { "BaseMetals-${basemetals_version}-mapped.jar" } + doFirst { + if (useLocalBaseMetals) return + def hash = java.security.MessageDigest.getInstance('SHA-256') + .digest(configurations.baseMetalsRelease.singleFile.bytes).encodeHex().toString() + if (hash != basemetals_sha256) throw new GradleException('Published Base Metals checksum mismatch') + } + doLast { + File target = file("run/with-basemetals/mods/BaseMetals-${basemetals_version}-mapped.jar") + if (baseJarHash(target) != baseJarHash(configurations.baseMetalsDevelopment.singleFile)) + throw new GradleException('Combined profile Base Metals jar does not match the selected candidate') + } +} + +tasks.register('generateCompatibilityRuns') { + dependsOn 'genEclipseRuns', 'prepareBaseMetalsProfile' + doLast { + if (project.ext.has('siblingCompatibilityEnabled') && siblingCompatibilityEnabled) return + File original = file('runClient.launch') + Node launch = new XmlParser().parse(original) + launch.stringAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.WORKING_DIRECTORY' } + .attributes().put('value', file('run/with-basemetals').absolutePath) + file('runClientWithBaseMetals.launch').setText(XmlUtil.serialize(launch), 'UTF-8') + } +} +tasks.named('eclipse') { dependsOn 'generateCompatibilityRuns' } +eclipse.synchronizationTasks 'generateCompatibilityRuns' + +ext.compatibilityBaseFiles = { [mapped: configurations.baseMetalsDevelopment.singleFile, + version: basemetals_version.toString()] } +apply from: 'gradle/eclipse-compatibility-114.gradle' + +tasks.register('verifyEclipseProductionClasspath') { + group = 'verification' + dependsOn 'eclipse' + doLast { + ['runClient.launch', 'runServer.launch', 'runClientWithBaseMetals.launch'].each { name -> + Node launch = new XmlParser().parse(file(name)) + if (!launch.booleanAttribute.any { it.attribute('key') == 'org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE' && it.attribute('value') == 'true' }) + throw new GradleException("${name} must exclude test code") + String modClasses = launch.mapAttribute.mapEntry.find { it.attribute('key') == 'MOD_CLASSES' }.attribute('value') + if (modClasses.contains('probe') || !modClasses.contains(runClasses.get().asFile.absolutePath)) + throw new GradleException("${name} leaks test classes") + String arguments = launch.stringAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.PROGRAM_ARGUMENTS' }.attribute('value') + def paths = arguments =~ /--(?:cache|metadata|to-srg|to-obf) "([^"]+)"/ + int count = 0 + paths.each { match -> + if (!new File(match[1]).exists()) throw new GradleException("${name} has a missing launcher input") + count++ + } + if (count != 4) throw new GradleException("${name} needs four quoted launcher paths") } + Properties prefs = new Properties() + file('.settings/org.eclipse.buildship.core.prefs').withInputStream { prefs.load(it) } + if (prefs.getProperty('gradle.user.home') != gradle.gradleUserHomeDir.canonicalPath) + throw new GradleException('Buildship uses a different physical Gradle cache') } } sourceSets.main.resources.srcDir('src/generated/resources') +def generateBarModels = tasks.register('generateBarModels', Exec) { + group = 'data generation' + commandLine 'node', 'tools/generate_bar_models.js' +} +tasks.named('processResources') { dependsOn generateBarModels } +tasks.named('sourcesJar') { dependsOn generateBarModels } +tasks.register('verifyBarModels', Exec) { + dependsOn generateBarModels + commandLine 'node', '--test', 'tools/test_bar_models.js' +} +tasks.named('check') { dependsOn 'verifyBarModels' } + +def portData = layout.buildDirectory.dir('generated/port-data') +def generatePortData = tasks.register('generatePortData', Exec) { + inputs.file 'tools/generate_114_data.js' + inputs.file 'src/main/java/zone/moddev/mc/modernmetals/material/MaterialCatalogue.java' + inputs.files(fileTree('src/main/resources/data'), fileTree('src/generated/resources/data')) + outputs.dir portData + commandLine 'node', 'tools/generate_114_data.js' +} +sourceSets.main.resources.srcDir(portData) + def recipeData = layout.buildDirectory.dir('generated/recipe-data') def generateRecipeData = tasks.register('generateRecipeData', Exec) { + dependsOn generatePortData group = 'data generation' inputs.file 'tools/generate_113_recipe_data.js' inputs.file 'src/main/java/zone/moddev/mc/modernmetals/material/MaterialCatalogue.java' inputs.files(fileTree('src/main/resources/data'), fileTree('src/generated/resources/data')) + inputs.dir portData outputs.dir recipeData commandLine 'node', 'tools/generate_113_recipe_data.js' } @@ -193,6 +454,13 @@ def verifyRecipeData = tasks.register('verifyRecipeData', Exec) { } tasks.named('check') { dependsOn verifyRecipeData } +tasks.register('verifyPortData', Exec) { + dependsOn generatePortData + commandLine 'node', '--test', 'tools/test_114_port.js' +} +tasks.named('check') { dependsOn 'verifyPortData' } +tasks.named('check') { dependsOn 'integrationTestClasses', 'clientIntegrationTestClasses' } + tasks.named('processResources') { inputs.property('modVersion', mod_version) filesMatching('META-INF/mods.toml') { expand mod_version: mod_version } @@ -215,8 +483,59 @@ def releaseJar = renamer.classes(tasks.named('jar', Jar)) { tasks.named('assemble') { dependsOn releaseJar } tasks.named('check') { dependsOn 'verifyReleaseDependencies' } -apply from: 'gradle/development-orespawn.gradle' +def probeJar = tasks.register('packagedProbeDeobfJar', Jar) { + dependsOn 'integrationTestClasses' + from sourceSets.integrationTest.output + archiveFileName = 'modernmetalsprobe-deobf.jar' + destinationDirectory = layout.buildDirectory.dir('packaged-probes') +} +def packagedProbeJar = renamer.classes(probeJar) { + map.from minecraft.dependency.toSrgFile + output = layout.buildDirectory.file('packaged-probes/modernmetalsprobe.jar') +} +tasks.register('runPackagedProbeServer', Exec) { + group = 'verification' + dependsOn releaseJar, packagedProbeJar, 'verifyReleaseDependencies' + dependsOn verifyLocalBase + timeout = java.time.Duration.ofMinutes(5) + doFirst { + File directory = file(providers.gradleProperty('probeDirectory').orElse('build/packaged-probe-server').get()).canonicalFile + if (!directory.toPath().startsWith(layout.buildDirectory.get().asFile.canonicalFile.toPath()) + && !new File(directory, '.modernmetals-disposable-test').isFile()) { + throw new GradleException('Packaged probe requires a build directory or an explicitly marked disposable copy') + } + directory.mkdirs() + File mods = new File(directory, 'mods') + copy { + from releaseJar, packagedProbeJar, configurations.oreSpawnRelease + if (withBaseMetals.get()) from(useLocalBaseMetals ? files(file(localBasePin.publishedJar)) : configurations.baseMetalsRelease) + into mods + } + if (!new File(directory, 'eula.txt').exists()) new File(directory, 'eula.txt').text = 'eula=true\n' + if (!new File(directory, 'server.properties').exists()) new File(directory, 'server.properties').text = + 'online-mode=false\nserver-port=0\nview-distance=2\nspawn-protection=0\nmax-tick-time=0\nlevel-seed=14162026\n' + File receipt = new File(directory, 'modernmetals-probe.json') + if (receipt.exists()) java.nio.file.Files.move(receipt.toPath(),new File(directory, + 'modernmetals-probe.' + System.currentTimeMillis() + '.previous.json').toPath()) + def runtime = providers.gradleProperty('packagedForgeServerRuntime').get() + File launcher = new File(runtime, "forge-${minecraft_version}-${forge_version}.jar") + if (!launcher.isFile()) throw new GradleException('Official Forge server runtime is incomplete') + workingDir directory + commandLine javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(8) }.get().executablePath.asFile, + '-Xmx2g', '-Dmodernmetalsprobe.upgrade=' + providers.gradleProperty('probeWorldUpgrade').orElse('false').get(), + '-Dmodernmetalsprobe.titanium=' + providers.gradleProperty('probeTitanium').orElse('false').get(), + '-jar', launcher.absolutePath, 'nogui' + if (providers.gradleProperty('probeWorldUpgrade').orElse('false').get().toBoolean()) args '--forceUpgrade' + } + doLast { + File receipt = new File(workingDir, 'modernmetals-probe.json') + if (!receipt.isFile() || new groovy.json.JsonSlurper().parse(receipt).status != 'passed') + throw new GradleException("Packaged test failed; see ${receipt}") + } +} + +// Uses the published OreSpawn release directly. -apply from: 'gradle/release-113.gradle' +apply from: 'gradle/release-114.gradle' apply from: 'gradle/normalize-javadoc-trees.gradle' diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index 4c9bef9c..974f1680 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -1,8 +1,11 @@ -# Upgrading a Modern Metals world to Minecraft 1.13.2 +# Upgrading a Modern Metals world to Minecraft 1.14.4 + +Released 1.13.2 saves already have named block states and use vanilla data fixing. +The legacy numeric conversion below is retained for older saves. Make a complete copy of the world. Keep the source outside the test instance. -Install Forge 25.0.223, Modern Metals 3.0.0.113021 and OreSpawn 4.1.7.113021. -Install the Forge 25 Base Metals version when upgrading a world that used +Install Forge 28.2.26, Modern Metals 3.0.0.114041 and OreSpawn 4.1.7.114041. +Install the Forge 28 Base Metals version when upgrading a world that used Base Metals or placed MMDLib's vanilla-extension blocks. Other add-ons need their own compatible versions and migration support. diff --git a/docs/PORTING_114.md b/docs/PORTING_114.md new file mode 100644 index 00000000..34768d26 --- /dev/null +++ b/docs/PORTING_114.md @@ -0,0 +1,87 @@ +# Minecraft 1.14.4 port + +The source is the released 1.13.2 Modern Metals tree, f05f7208. Base Metals' +1.14.4 port is an API reference; its older hardness-derived mining tiers +were deliberately not copied over the later Modern Metals material audit. + +## Target decisions + +- Forge 28.2.26, MCP snapshot 20190719-1.14.3 / config 20190829.143755. Java 8 + remains the compilation and game target. Gradle 9.6.1 and ForgeGradle 7 use + the same toolchain arrangement as Base Metals. +- Block loot moved to data in 1.14. Generated tables cover every solid block + and historical alloy ore. Doors drop only their lower half, double slabs + drop two slabs, and fluids have empty tables. Ore blocks remain pickaxe + drops; raw ore is a later Minecraft feature. +- Blast furnaces use their own native recipe type. Native metal processing + gets matching inputs and outputs at half the cooking time. Recycling + retains the ordinary furnace and its multi-output serializer. +- Recipes use `CraftingInventory`, native `IRecipeType` and registered Forge + serializers. Shared crushing recipes deserialize through Base Metals' + serializer when installed, retaining their contribution IDs. +- Forge's typed conditions replace the old reflective tag condition. Empty + optional tags keep cross-mod alloys absent safely. The five formulas, + Chrome aliases, direct steel blends and coal ownership are preserved. +- Forge fluid attributes replace the Forge 25 renderer hook. Still and + flowing textures are animated; buckets retain their material colours. + Fluid construction and crafting-condition registration remain sequential. +- Smith trades now use the armorer, toolsmith and weaponsmith professions, + with restocking, experience and Fantasy policy checks. +- Configuration uses the native 1.14 Mods-list factory and OreSpawn child + factory. Standalone Fantasy Level remains local; Base Metals supplies + the effective setting when present. Modes stay latched until restart. +- Saved IDs, named states and old item aliases are retained. Legacy numeric + migration hooks run before vanilla data fixing; completed old chunks use + 1.14's `full` status. Existing terrain guards use primitive chunk-key sets. +- OreSpawn owns generation. The ore-only schema-5 provider keeps its 17 rule + IDs, material groups, heights and dimension selector. Titanium stays off + and retrogen stays off. No terrain or fallback generator was added. + +References: [Forge's 1.14 porting notes](https://docs.minecraftforge.net/en/1.14.x/legacy/porting1214/), +[Minecraft 1.14.4 notes](https://feedback.minecraft.net/hc/en-us/articles/360030780172-Minecraft-Java-Edition-1-14-4), +the exact mapped Forge/Minecraft sources, and +[OreSpawn 4.1.7.114041](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.114041). + +## Verification + +The build runs resource-generation, startup-order, processing and explicit +mining-tier checks. `runRuntimeProbeServer` and `runProbeClient` are explicit +automated tests, using separate source sets excluded from production jars. +Use `-PwithBaseMetals=true` to test the published Base Metals dependency. +World-upgrade runs accept only disposable copies in a separate probe directory. + +Manual acceptance and publication are separate steps. The local verification +receipt records the exact artifacts, +passed and failed attempts, and the copied-world source fingerprints. + + +The local candidate passed a clean build, all archive and Eclipse checks, +and an exact rebuild comparison of the player, source and Javadoc jars. +The native server checks cover every registered block drop, component yields, +alloy processing, plate repairs, beryllium discovery, smith offers, fluids, +survival hammer mining and all 21 ranged-weapon families. Both Fantasy modes +were checked standalone and alongside the published Base Metals dependency. + +Nine new chunks in each vanilla dimension contain the expected Modern Metals +ores only in the Overworld. Enabling titanium adds its ore without changing +rutile's rule. The normal provider keeps titanium and retrogen disabled. + +Client checks cover 967 item models, overlay layers and transparency, bucket +colours, configuration factories, saving and reopening an integrated world. +The test waits for the first integrated-server thread to finish before +reopening its save and rejects unexpected error logs. + +Representative copied-world checks preserved 302,255 Modern Metals blocks +from 1.10, 199,176 from 1.11, and 289,362 from a 1.12 metadata fixture, together +with their saved stacks. A released 1.13 world and additional fixtures cover +stable block IDs, fluids, historical alloy ores, buckets, and a named, +enchanted, worn hammer. Packaged reloads passed and the original fixture +fingerprints remained unchanged. These checks do not replace backups or +manual acceptance of a particular modpack. + +`runPackagedProbeServer` tests the actual player jar; supply +`-PpackagedForgeServerRuntime=`. +Use `-PprobeDirectory=` and `-PprobeWorldUpgrade=true` for +upgrade tests. Copies outside `build` or `run/verification` must contain a +`.modernmetals-disposable-test` marker. Test receipts and failed attempts are +kept locally, outside published artifacts. diff --git a/docs/PROCESSING.md b/docs/PROCESSING.md index edda688f..8e949324 100644 --- a/docs/PROCESSING.md +++ b/docs/PROCESSING.md @@ -81,3 +81,11 @@ setting when it is installed. Crushing and plate repairs use their normal gameplay entry points. The recipe books display crafting and furnace recipes. + +## Minecraft 1.14.4 + +The blast furnace accepts native ores, powders, small powders, blends and +small blends at twice the furnace speed, with the same output. Recycling +stays in the ordinary furnace. Four rods cost two ingots; four gears cost +four ingots and one rod; three plates cost three ingots. Recycling rounds +down and never returns more metal than the cheapest native crafting route. diff --git a/docs/RELEASING.md b/docs/RELEASING.md index d9e99bee..8566be7c 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,16 +1,16 @@ -# Releasing Modern Metals for Minecraft 1.13.2 +# Releasing Modern Metals for Minecraft 1.14.4 Build with Java 17, Temurin 8u502-b07 for compilation and Java 25 for -Mavenizer. Run check, build, verify113ReleaseArtifacts, -write113ReleaseChecksums, genEclipseRuns and eclipse. Keep the packaged +Mavenizer. Run check, build, verify114ReleaseArtifacts, +write114ReleaseChecksums, genEclipseRuns and eclipse. Keep the packaged gameplay and saved-world checks local, then complete manual testing. -Open a PR from the fork to MMD's master-1.13.2. After merging, wait for the -successful push CI run and download ModernMetals-1.13.2-. Compare +Open a PR from the fork to MMD's master-1.14.4. After merging, wait for the +successful push CI run and download ModernMetals-1.14.4-. Compare all three jars with the locally qualified bundle. The CI bundle contains the player, sources and Javadoc jars, SHA256SUMS and CHANGELOG.txt. -Run deploy-release.yml on master-1.13.2 with the release version, full merged +Run deploy-release.yml on master-1.14.4 with the release version, full merged commit and qualified game-jar SHA-256. Leave confirm_live_publication false for verification. Set it true only when publication is authorised. The workflow checks the branch tip, successful merged CI and bundle hashes, @@ -25,4 +25,4 @@ Verify anonymous downloads and hashes on all three services, including the CurseForge dependency metadata. If a publication job fails, preserve its logs and retry only the failed job; do not duplicate an accepted upload. Base Metals is optional and OreSpawn is required. Publish Base Metals first -and keep the compatibility pin on its public 1.13.2 release. +and keep the compatibility pin on its public 1.14.4 release. diff --git a/gradle.properties b/gradle.properties index cdcb064c..921cb059 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,13 +3,16 @@ org.gradle.daemon=false org.gradle.configuration-cache=false org.gradle.parallel=false net.minecraftforge.gradle.merge-source-sets=false -minecraft_version=1.13.2 -forge_version=25.0.223 +minecraft_version=1.14.4 +forge_version=28.2.26 mapping_channel=snapshot -mapping_version=20180921-1.13 -mcp_version=20190213.203750 +mapping_version=20190719-1.14.3 +mcp_version=20190829.143755 mod_id=modernmetals -mod_version=3.0.0.113021 +mod_version=3.0.0.114041 mod_group=zone.moddev.mc.modernmetals -orespawn_curse_file=9611746 -orespawn_sha256=e65dcca0623a20111c40779cb0fe2078e98c618faa68f79c9a28e1e53c63957e +basemetals_version=3.0.2.114041 +basemetals_sha256=11c0c4a6fe26b22ee794ea76cd6e0f1c5b65fb03540f9e8e0c52425cfefb062b +orespawn_sha256=c6171543240d43cd6273601d537d46a8f8c8a8b5992b258827e2f6f713ab7d44 + +orespawn_version=4.1.7.114041 diff --git a/gradle/development-orespawn.gradle b/gradle/development-orespawn.gradle deleted file mode 100644 index 4fe34518..00000000 --- a/gradle/development-orespawn.gradle +++ /dev/null @@ -1,100 +0,0 @@ -import groovy.xml.XmlParser -import groovy.xml.XmlUtil -import java.security.MessageDigest -import java.util.jar.JarFile - -// An optional manual-test engine. Compilation and publication still use the release pin. -File candidate = layout.projectDirectory.file('run/compatibility-jars/orespawn-development.jar').asFile -boolean enabled = candidate.isFile() && providers.gradleProperty('useDevelopmentOreSpawn') - .map { it.toBoolean() }.getOrElse(false) -tasks.matching { it.name in ['genEclipseRunClientForForge', 'genEclipseRunServerForForge'] }.configureEach { - inputs.property('usesDevelopmentOreSpawn', enabled) -} -if (!enabled) return -File checksum = new File(candidate.parentFile, 'orespawn-development.sha256') -String publishedName = "mmd-orespawn-245586-${orespawn_curse_file}-renamed.jar" - -def verifyCandidate = tasks.register('verifyDevelopmentOreSpawn') { - inputs.file candidate - inputs.file checksum - inputs.files configurations.oreSpawnRelease - doLast { - String expected = checksum.text.trim().toLowerCase(Locale.ROOT) - String actual = MessageDigest.getInstance('SHA-256').digest(candidate.bytes).encodeHex().toString() - if (!(expected ==~ /[0-9a-f]{64}/) || actual != expected) { - throw new GradleException('The development OreSpawn jar does not match its recorded checksum.') - } - new JarFile(configurations.oreSpawnRelease.singleFile).withCloseable { release -> - new JarFile(candidate).withCloseable { development -> - String version = release.manifest.mainAttributes.getValue('Implementation-Version') - if (development.manifest.mainAttributes.getValue('Implementation-Version') != version) { - throw new GradleException('The development OreSpawn jar targets a different release. Update or disable it.') - } - def api = release.entries().toList().findAll { - it.name.startsWith('zone/moddev/mc/orespawn/api/') && it.name.endsWith('.class') - } - if (api.empty) throw new GradleException('The pinned OreSpawn public API is missing.') - api.each { entry -> - def replacement = development.getJarEntry(entry.name) - if (replacement == null || !Arrays.equals(release.getInputStream(entry).bytes, - development.getInputStream(replacement).bytes)) { - throw new GradleException("The development engine changes the pinned public API: ${entry.name}") - } - } - } - } - } -} - -def renameJarType = renamer.class.classLoader.loadClass('net.minecraftforge.renamer.gradle.RenameJar') -def mappedCandidate = tasks.register('mapDevelopmentOreSpawn', renameJarType, renamer) -mappedCandidate.configure { - dependsOn verifyCandidate - input.set(candidate) - output.set(layout.buildDirectory.file('development/OreSpawn-development-mapped.jar')) - map.from minecraft.dependency.toSrgFile - reverse.set(true) - // Published Forge 1.13 jars retain named classes with SRG member names. - naiveSrg.set(true) - accessTransformers.set(true) - libraries.from(sourceSets.main.compileClasspath.filter { it.name != publishedName }) -} - -def developmentClasspath = { JavaExec run -> - def original = run.classpath.files.toList() - if (original.count { it.name == publishedName } != 1) { - throw new GradleException('Expected one published OreSpawn entry in the normal development runtime.') - } - original.findAll { it.name != publishedName } + mappedCandidate.get().output.get().asFile -} - -tasks.withType(JavaExec).configureEach { - if (name in ['runClient', 'runServer']) { - dependsOn mappedCandidate - doFirst { JavaExec run -> run.classpath = project.files(developmentClasspath(run)) } - } -} - -tasks.matching { it.name in ['genEclipseRunClientForForge', 'genEclipseRunServerForForge'] }.configureEach { - dependsOn mappedCandidate - doLast { - String runName = name.replaceFirst('^genEclipseRun', 'run').replaceFirst('ForForge$', '') - File launch = layout.projectDirectory.file(runName + '.launch').asFile - Node configuration = new XmlParser().parse(launch) - Node entries = configuration.listAttribute.find { - it.attribute('key') == 'org.eclipse.jdt.launching.CLASSPATH' - } - def jre = entries.listEntry.findAll { - new XmlParser().parseText(it.attribute('value')).attribute('containerPath')?.startsWith( - 'org.eclipse.jdt.launching.JRE_CONTAINER/') - }.collect { it.attribute('value') } - entries.children().clear() - developmentClasspath(tasks.named(runName, JavaExec).get()).each { File entry -> - Node runtimeEntry = new Node(null, 'runtimeClasspathEntry', - [externalArchive: entry.absolutePath, type: '2', path: '5']) - new Node(entries, 'listEntry', [value: XmlUtil.serialize(runtimeEntry)]) - } - jre.each { new Node(entries, 'listEntry', [value: it]) } - launch.setText(XmlUtil.serialize(configuration), 'UTF-8') - } -} diff --git a/gradle/eclipse-compatibility-114.gradle b/gradle/eclipse-compatibility-114.gradle new file mode 100644 index 00000000..103e5833 --- /dev/null +++ b/gradle/eclipse-compatibility-114.gradle @@ -0,0 +1,174 @@ +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.xml.XmlParser +import groovy.xml.XmlUtil +import java.nio.file.Files +import java.nio.file.StandardCopyOption +import java.security.MessageDigest +import java.util.zip.ZipFile + +// These local candidates are optional development inputs, never release dependencies. +def pinFile = file('local-sibling-mods.json') +def release = providers.gradleProperty('releaseBuild').map { it.toBoolean() }.orElse(false).get() +def enabled = pinFile.isFile() && !release +ext.siblingCompatibilityEnabled = enabled +Map pins = enabled ? new JsonSlurper().parse(pinFile) : [:] +def definitions = [ + basegems: [name: 'BaseGems', checkout: '../../Base Gems 114/BaseGems', property: 'baseGemsCheckout'], + baseminerals: [name: 'BaseMinerals', checkout: '../../Base Minerals 114/BaseMinerals', property: 'baseMineralsCheckout'] +] +def digest = { File jar -> MessageDigest.getInstance('SHA-256').digest(jar.bytes).encodeHex().toString() } +def siblingJar = { File f -> + if (!f.name.toLowerCase(Locale.ROOT).endsWith('.jar')) return false + if (f.name ==~ /(?i)(?:BaseMetals-|BaseGems-|BaseMinerals-|base-metals-240967-).+\.jar/) return true + new ZipFile(f).withCloseable { zip -> + def metadata = zip.getEntry('META-INF/mods.toml') + metadata != null && (zip.getInputStream(metadata).getText('UTF-8') =~ /modId\s*=\s*"(?:basemetals|basegems|baseminerals)"/).find() + } +} +def profiles = [ + 'Standalone': [], 'Base Metals': ['basemetals'], 'Base Gems': ['basegems'], + 'Base Minerals': ['baseminerals'], 'Base Metals + Base Gems': ['basemetals', 'basegems'], + 'Base Metals + Base Minerals': ['basemetals', 'baseminerals'], + 'Base Gems + Base Minerals': ['basegems', 'baseminerals'], + 'All Add-ons': ['basemetals', 'basegems', 'baseminerals'] +] +ext.siblingCompatibilityProfiles = profiles + +tasks.register('pinLocalSiblingMods') { + group = 'development' + description = 'Pins the already-built 1.14 Base Gems and Base Minerals player/mapped jars.' + doLast { + Map next = [:] + definitions.each { id, definition -> + File checkout = file(providers.gradleProperty(definition.property).orElse(definition.checkout).get()).canonicalFile + Properties properties = new Properties() + new File(checkout, 'gradle.properties').withInputStream { properties.load(it) } + String version = properties.getProperty('mod_version') + if (!version?.endsWith('.114041')) throw new GradleException("Not a Forge 1.14.4 candidate: ${checkout}") + Map entry = [version: version] + [player: "build/libs/${definition.name}-${version}.jar", mapped: "build/libs-dev/${definition.name}-${version}-deobf.jar"].each { kind, relative -> + File jar = new File(checkout, relative) + if (!jar.isFile()) throw new GradleException("Build ${definition.name} first: ${jar}") + entry[kind + 'Jar'] = jar.canonicalPath + entry[kind + 'Sha256'] = digest(jar) + } + next[id] = entry + } + pinFile.setText(JsonOutput.prettyPrint(JsonOutput.toJson(next)) + '\n', 'UTF-8') + } +} +def verifyPins = tasks.register('verifyLocalSiblingMods') { + group = 'verification' + doLast { + if (!enabled) return + definitions.each { id, definition -> + Map pin = pins[id] + if (!pin || !pin.version?.endsWith('.114041')) throw new GradleException("Missing 1.14 ${definition.name} pin; run pinLocalSiblingMods") + ['player', 'mapped'].each { kind -> + File jar = file(pin[kind + 'Jar']) + if (!jar.isFile() || digest(jar) != pin[kind + 'Sha256']) throw new GradleException("Local ${definition.name} changed. Run pinLocalSiblingMods, then regenerate Eclipse launches: ${jar}") + } + } + } +} + +def profileDirectory = { label, mods -> + label == 'Standalone' ? file('run') : label == 'Base Metals' ? file('run/with-basemetals') : file('run/compatibility/' + mods.join('-')) +} +def expectedFiles = { mods -> + Map result = [:] + mods.each { id -> + if (id == 'basemetals') { + Map base = compatibilityBaseFiles() + result["BaseMetals-${base.version}-mapped.jar".toString()] = base.mapped + } else { + result["${definitions[id].name}-${pins[id].version}-mapped.jar".toString()] = file(pins[id].mappedJar) + } + } + result +} +// Explicit production-only entries avoid inheriting optional runtime mods from a +// Buildship container configured with -PwithBaseMetals=true. +def isolatedLaunch = { File directory -> + Node launch = new XmlParser().parse(file('runClient.launch')) + launch.stringAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.WORKING_DIRECTORY' }.attributes().put('value', directory.absolutePath) + Node cp = launch.listAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.CLASSPATH' } + List jre = cp.listEntry.findAll { it.attribute('value').contains('org.eclipse.jdt.launching.JRE_CONTAINER') }.toList() + List launchers = cp.listEntry.collect { new XmlParser().parseText(it.attribute('value')) }.findAll { + it.attribute('externalArchive')?.contains('slime-launcher-') + }.collect { file(it.attribute('externalArchive')) } + cp.children().clear() + (sourceSets.main.runtimeClasspath.files + launchers).findAll { !siblingJar(it) }.unique().each { File f -> + Node entry = new Node(null, 'runtimeClasspathEntry', [externalArchive: f.absolutePath, type: '2', path: '5']) + new Node(cp, 'listEntry', [value: XmlUtil.serialize(entry)]) + } + jre.each { cp.append(it) } + launch +} +def generate = tasks.register('prepareCompatibilityLaunches') { + group = 'ide' + description = 'Stages exact sibling candidates and generates all eight isolated Eclipse clients.' + dependsOn 'genEclipseRuns', 'prepareBaseMetalsProfile', verifyPins + doLast { + if (!enabled) return + profiles.each { label, mods -> + File directory = profileDirectory(label, mods).canonicalFile + File modsDir = new File(directory, 'mods') + if (!directory.toPath().startsWith(file('run').canonicalFile.toPath())) throw new GradleException('Unsafe profile directory') + modsDir.mkdirs() + Map selected = expectedFiles(mods) + // Retain stale managed copies, preserving worlds, config and unrelated mods. + modsDir.listFiles().findAll { it.isFile() && siblingJar(it) && (!selected.containsKey(it.name) || digest(it) != digest(selected[it.name])) }.each { obsolete -> + File retained = file('.gradle/retired-compatibility-jars/' + label.replace(' ', '_') + '/' + digest(obsolete) + '-' + obsolete.name).canonicalFile + if (!retained.toPath().startsWith(file('.gradle/retired-compatibility-jars').canonicalFile.toPath())) throw new GradleException('Unsafe retention path') + retained.parentFile.mkdirs() + Files.copy(obsolete.toPath(), retained.toPath(), StandardCopyOption.REPLACE_EXISTING) + if (digest(retained) != digest(obsolete)) throw new GradleException('Retained jar differs') + Files.delete(obsolete.toPath()) + } + selected.each { name, source -> + File target = new File(modsDir, name) + if (!target.isFile() || digest(target) != digest(source)) Files.copy(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING) + if (digest(target) != digest(source)) throw new GradleException("Profile jar differs: ${target}") + } + Node launch = isolatedLaunch(directory) + file("Modern Metals - ${label}.launch").setText(XmlUtil.serialize(launch), 'UTF-8') + if (label == 'Base Metals') file('runClientWithBaseMetals.launch').setText(XmlUtil.serialize(launch), 'UTF-8') + } + } +} +// The existing entry point remains the Gradle-refresh hook and compatibility alias. +tasks.named('generateCompatibilityRuns') { dependsOn generate } + +tasks.register('verifyCompatibilityLaunches') { + group = 'verification' + dependsOn 'generateCompatibilityRuns' + doLast { + if (!enabled) return + Map receipt = [:] + profiles.each { label, mods -> + File directory = profileDirectory(label, mods).canonicalFile + Map expected = expectedFiles(mods) + def actual = new File(directory, 'mods').listFiles().findAll { it.isFile() && siblingJar(it) } + if (actual.collect { it.name }.sort() != expected.keySet().toList().sort()) throw new GradleException("Wrong siblings in ${label}") + actual.each { if (digest(it) != digest(expected[it.name])) throw new GradleException("Wrong jar in ${label}: ${it}") } + Node launch = new XmlParser().parse(file("Modern Metals - ${label}.launch")) + String working = launch.stringAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.WORKING_DIRECTORY' }.attribute('value') + if (file(working).canonicalFile != directory) throw new GradleException("Wrong working directory: ${label}") + if (!launch.booleanAttribute.any { it.attribute('key') == 'org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE' && it.attribute('value') == 'true' }) throw new GradleException("Test code exposed: ${label}") + launch.listAttribute.find { it.attribute('key') == 'org.eclipse.jdt.launching.CLASSPATH' }.listEntry.each { + Node entry = new XmlParser().parseText(it.attribute('value')) + String archive = entry.attribute('externalArchive') + if (archive && (!file(archive).exists() || siblingJar(file(archive)) || archive.contains('probe') || archive.contains('integrationTest'))) throw new GradleException("Unsafe classpath entry in ${label}: ${archive}") + if (it.attribute('value').contains('org.eclipse.buildship.core.gradleclasspathcontainer')) throw new GradleException("Optional classpath container exposed: ${label}") + } + receipt[label] = [directory: directory.absolutePath, mods: mods, sha256: actual.collectEntries { [(it.name): digest(it)] }] + } + File report = file('build/reports/compatibility-profiles.json') + report.parentFile.mkdirs() + report.setText(JsonOutput.prettyPrint(JsonOutput.toJson(receipt)) + '\n', 'UTF-8') + } +} +tasks.named('eclipse') { dependsOn 'verifyCompatibilityLaunches' } +tasks.named('check') { dependsOn verifyPins } diff --git a/gradle/release-113.gradle b/gradle/release-114.gradle similarity index 85% rename from gradle/release-113.gradle rename to gradle/release-114.gradle index 46d3c1b3..dad62904 100644 --- a/gradle/release-113.gradle +++ b/gradle/release-114.gradle @@ -37,13 +37,13 @@ tasks.withType(Javadoc).configureEach { tasks.named('jar', Jar) { manifest.attributes('Implementation-Title': archiveName, 'Implementation-Version': project.version, 'Maven-Artifact': "${expectedGroup}:${archiveName}:${project.version}".toString(), - 'Build-Target': 'minecraft-1.13.2-forge-25.0.223-java-8') + 'Build-Target': 'minecraft-1.14.4-forge-28.2.26-java-8') } tasks.named('assemble') { dependsOn playerJar, tasks.named('sourcesJar'), tasks.named('javadocJar') } def sha256 = { File file -> MessageDigest.getInstance('SHA-256').digest(file.bytes).encodeHex().toString() } def audit = { File directory -> - if (project.group.toString() != expectedGroup || !(project.version.toString() ==~ /\d+\.\d+\.\d+\.113021/)) { + if (project.group.toString() != expectedGroup || !(project.version.toString() ==~ /\d+\.\d+\.\d+\.114041/)) { throw new GradleException('Wrong Maven or Minecraft release identity') } if (directory.listFiles().findAll { it.name.endsWith('.jar') }.collect { it.name }.sort() != releaseNames.sort(false)) { @@ -76,8 +76,9 @@ def audit = { File directory -> String metadata = zip.getInputStream(zip.getEntry('META-INF/mods.toml')).getText('UTF-8') if (metadata.contains('${') || !metadata.contains('modId="' + modId + '"') || !metadata.contains('version="' + project.version + '"') - || !metadata.contains('versionRange="[1.13.2]"') - || !metadata.contains('versionRange="[4.1.7.113021,5.0.0)"')) { + || !metadata.contains('versionRange="[1.14.4]"') + || !metadata.contains('versionRange="[4.1.7.114041,5.0.0)"') + || !metadata.contains('versionRange="[' + project.basemetals_version + ',4.0.0)"')) { throw new GradleException('Wrong or unresolved release mod metadata') } } @@ -85,14 +86,14 @@ def audit = { File directory -> } } -tasks.register('verify113ReleaseArtifacts') { +tasks.register('verify114ReleaseArtifacts') { group = 'verification' dependsOn tasks.named('assemble'), tasks.named('check') doLast { audit(layout.buildDirectory.dir('libs').get().asFile) } } -tasks.register('write113ReleaseChecksums') { +tasks.register('write114ReleaseChecksums') { group = 'verification' - dependsOn tasks.named('verify113ReleaseArtifacts') + dependsOn tasks.named('verify114ReleaseArtifacts') doLast { File output = layout.buildDirectory.file('release/SHA256SUMS').get().asFile output.parentFile.mkdirs() @@ -101,7 +102,7 @@ tasks.register('write113ReleaseChecksums') { }.join('\n') + '\n', 'UTF-8') } } -tasks.register('verify113PreparedReleaseArtifacts') { +tasks.register('verify114PreparedReleaseArtifacts') { group = 'verification' doLast { if (!preparedDirectory.isPresent()) throw new GradleException('preparedReleaseDir is required') @@ -145,7 +146,7 @@ publishing { } pom { name = 'Modern Metals' - description = 'Modern Metals for Minecraft 1.13.2, using Forge 25 and OreSpawn 4.' + description = 'Modern Metals for Minecraft 1.14.4, using Forge 28 and OreSpawn 4.' url = 'https://github.com/MinecraftModDevelopmentMods/ModernMetals' licenses { license { @@ -154,6 +155,13 @@ publishing { } } } + pom.withXml { + def dependency = asNode().appendNode('dependencies').appendNode('dependency') + dependency.appendNode('groupId', 'zone.moddev.mc.basemetals') + dependency.appendNode('artifactId', 'BaseMetals') + dependency.appendNode('version', project.basemetals_version.toString()) + dependency.appendNode('optional', 'true') + } } } repositories { @@ -167,18 +175,25 @@ publishing { } } } -tasks.register('verify113MavenCoordinates') { +tasks.register('verify114MavenCoordinates') { dependsOn 'generatePomFileForMavenJavaPublication' doLast { def pom = new XmlSlurper(false, false).parse(layout.buildDirectory.file('publications/mavenJava/pom-default.xml').get().asFile) if ([pom.groupId.text(), pom.artifactId.text(), pom.version.text()] != [expectedGroup, archiveName, project.version.toString()]) { throw new GradleException('Wrong Maven publication coordinates') } + if (!pom.dependencies.dependency.any { it.groupId.text() == 'zone.moddev.mc.basemetals' + && it.artifactId.text() == 'BaseMetals' && it.version.text() == project.basemetals_version.toString() + && it.optional.text() == 'true' }) { + throw new GradleException('Maven metadata must pin the optional released Base Metals dependency') + } } } + +tasks.named('check') { dependsOn 'verify114MavenCoordinates' } tasks.withType(PublishToMavenRepository).configureEach { - dependsOn 'verify113MavenCoordinates' - dependsOn preparedDirectory.isPresent() ? 'verify113PreparedReleaseArtifacts' : 'verify113ReleaseArtifacts' + dependsOn 'verify114MavenCoordinates' + dependsOn preparedDirectory.isPresent() ? 'verify114PreparedReleaseArtifacts' : 'verify114ReleaseArtifacts' doFirst { def url = providers.environmentVariable('MAVEN_UPLOAD_URL').getOrElse('') if (!url.startsWith('https://') || url.startsWith('https://invalid.invalid') diff --git a/gradle/stage-orespawn-release.sh b/gradle/stage-orespawn-release.sh deleted file mode 100644 index 082ba705..00000000 --- a/gradle/stage-orespawn-release.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -mirror="${1:?Supply a local dependency mirror}" -file_id=9611746 -archive="$mirror/curse/maven/mmd-orespawn-245586/$file_id/mmd-orespawn-245586-$file_id.jar" -mkdir -p "$(dirname "$archive")" -if [[ ! -f "$archive" ]]; then - temporary="$(mktemp "$(dirname "$archive")/orespawn.XXXXXX")" - trap 'rm -f "$temporary"' EXIT - curl --fail --silent --show-error --location --retry 3 --max-time 60 \ - 'https://mediafilez.forgecdn.net/files/9611/746/OreSpawn-4.1.7.113021.jar' -o "$temporary" - printf '%s %s\n' e65dcca0623a20111c40779cb0fe2078e98c618faa68f79c9a28e1e53c63957e "$temporary" | sha256sum --check - mv "$temporary" "$archive" -fi -printf '%s %s\n' e65dcca0623a20111c40779cb0fe2078e98c618faa68f79c9a28e1e53c63957e "$archive" | sha256sum --check diff --git a/gradle/stage-release-dependencies.sh b/gradle/stage-release-dependencies.sh new file mode 100644 index 00000000..6953189a --- /dev/null +++ b/gradle/stage-release-dependencies.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail +mirror="${1:?Supply a local dependency mirror}" +project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +value() { sed -n "s/^$1=//p" "$project_dir/gradle.properties" | tr -d '\r'; } +version="$(value basemetals_version)" +expected="$(value basemetals_sha256)" +[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.114041$ ]] +[[ "$expected" =~ ^[0-9a-f]{64}$ ]] +archive="$mirror/zone/moddev/mc/basemetals/BaseMetals/$version/BaseMetals-$version.jar" +mkdir -p "$(dirname "$archive")" +if [[ ! -f "$archive" ]]; then + temporary="$(mktemp "$(dirname "$archive")/basemetals.XXXXXX")" + trap 'rm -f "$temporary"' EXIT + curl --fail --silent --show-error --location --retry 3 --max-time 60 \ + "https://maven.moddev.zone/releases/zone/moddev/mc/basemetals/BaseMetals/$version/BaseMetals-$version.jar" -o "$temporary" + printf '%s %s\n' "$expected" "$temporary" | sha256sum --check + mv "$temporary" "$archive" +fi +printf '%s %s\n' "$expected" "$archive" | sha256sum --check diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java new file mode 100644 index 00000000..f64dc95a --- /dev/null +++ b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java @@ -0,0 +1,47 @@ +package zone.moddev.mc.modernmetals.testmod; + +import java.util.*; +import net.minecraft.block.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.model.*; +import net.minecraft.state.IProperty; +import net.minecraft.util.Direction; +import net.minecraftforge.registries.ForgeRegistries; + +/** Compare all connected bars against the target game's own iron bars. */ +final class BarModelChecks { + static int run(Minecraft mc,String namespace){ + int checks=0,materials=0; + for(Block block:ForgeRegistries.BLOCKS.getValues()){ + if(!block.getRegistryName().getNamespace().equals(namespace)||!block.getRegistryName().getPath().endsWith("_bars"))continue; + materials++; + for(BlockState state:block.getStateContainer().getValidStates()){ + BlockState vanilla=Blocks.IRON_BARS.getDefaultState(); + for(IProperty property:vanilla.getProperties()){ + IProperty actual=state.getBlock().getStateContainer().getProperty(property.getName()); + if(actual!=null)vanilla=vanilla.with(property,state.get(actual)); + } + Map expected=geometry(mc,vanilla),actual=geometry(mc,state); + if(!actual.equals(expected))throw new IllegalStateException("Bars geometry differs from vanilla: "+state+" expected "+expected.size()+" faces, actual "+actual.size()); + checks++; + } + } + if(materials==0)throw new IllegalStateException("No bars checked for "+namespace); + System.out.println("BARS_MODEL_CHECK PASS mod="+namespace+" materials="+materials+" states="+checks); + return checks; + } + private static Map geometry(Minecraft mc,BlockState state){ + IBakedModel model=mc.getBlockRendererDispatcher().getModelForState(state); + if(model==mc.getModelManager().getMissingModel())throw new IllegalStateException("Missing bars model "+state); + List quads=new ArrayList<>(model.getQuads(state,null,new Random(42))); + for(Direction side:Direction.values())quads.addAll(model.getQuads(state,side,new Random(42))); + Map result=new TreeMap<>(); + for(BakedQuad quad:quads){ + if(quad.getSprite().getName().getPath().equals("missingno"))throw new IllegalStateException("Missing bars sprite "+state); + int[] data=quad.getVertexData();int stride=data.length/4;List vertices=new ArrayList<>(); + for(int v=0;v<4;v++)vertices.add(Math.round(Float.intBitsToFloat(data[v*stride])*1000000)+","+Math.round(Float.intBitsToFloat(data[v*stride+1])*1000000)+","+Math.round(Float.intBitsToFloat(data[v*stride+2])*1000000)); + Collections.sort(vertices);String key=quad.getFace()+vertices.toString();result.merge(key,1,Integer::sum); + } + return result; + } +} diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java new file mode 100644 index 00000000..9b330db9 --- /dev/null +++ b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java @@ -0,0 +1,187 @@ +package zone.moddev.mc.modernmetals.testmod; +import java.util.*; +import net.minecraft.block.Block; +import java.nio.file.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screen.*; +import net.minecraft.client.gui.widget.button.Button; +import net.minecraft.client.renderer.model.*; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraft.world.*; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.*; +import net.minecraftforge.fml.common.Mod; +import zone.moddev.mc.modernmetals.client.ModernMetalsConfigScreen; +import zone.moddev.mc.modernmetals.config.*; +import zone.moddev.mc.modernmetals.content.*; +import zone.moddev.mc.orespawn.api.client.WorldSettingsExtensionRegistry; + +/** Explicit automated client gate; excluded from production and manual profiles. */ +@Mod("modernmetalsclientprobe") +@Mod.EventBusSubscriber(modid="modernmetalsclientprobe",value=Dist.CLIENT) +public final class ModernMetalsClientProbe { + private static int state,ticks,loaded; + private static net.minecraft.server.MinecraftServer stopping; + private static void require(boolean value,String message){if(!value)throw new IllegalStateException(message);} + @SubscribeEvent public static void tick(TickEvent.ClientTickEvent event){ + if(event.phase!=TickEvent.Phase.END||state==5)return; + Minecraft mc=Minecraft.getInstance(); + try{ + if(ticks%200==0)System.out.println("MODERN_CLIENT_STAGE "+state+" screen="+(mc.currentScreen==null?"null":mc.currentScreen.getClass().getName())); + if(mc.currentScreen instanceof net.minecraftforge.fml.client.gui.LoadingErrorScreen){ + StringBuilder details=new StringBuilder(); + for(java.lang.reflect.Field f:mc.currentScreen.getClass().getDeclaredFields())if(java.util.List.class.isAssignableFrom(f.getType())){ + f.setAccessible(true);for(Object message:(java.util.List)f.get(mc.currentScreen)){ + if(message instanceof net.minecraftforge.fml.ModLoadingWarning)details.append(((net.minecraftforge.fml.ModLoadingWarning)message).formatToString()); + else details.append(message); + } + } + throw new IllegalStateException("Forge loading screen: "+details); + } + if(++ticks>3600)throw new IllegalStateException("Client gate timeout in stage "+state); + if(state==0&&mc.currentScreen instanceof MainMenuScreen){ + validate(mc); + if(Boolean.getBoolean("modernmetalsclientprobe.menuOnly")){ + Files.write(Paths.get("client-probe.json"),("{\"status\":\"passed\",\"menuOnly\":true,\"expectedSiblings\":\""+System.getProperty("modernmetalsclientprobe.expectedSiblings","")+"\"}").getBytes(java.nio.charset.StandardCharsets.UTF_8));state=5;mc.shutdown();return; + } + mc.launchIntegratedServer("modernmetals-smoke","Modern Metals 1.14 smoke",new WorldSettings(14162026L,GameType.CREATIVE,false,false,WorldType.DEFAULT));state=1;ticks=0; + }else if(state==1&&mc.world!=null&&mc.player!=null&&++loaded>80){ + stopping=mc.getIntegratedServer();mc.world.sendQuittingDisconnectingPacket();mc.loadWorld(null);mc.displayGuiScreen(new MainMenuScreen());state=2;ticks=0;loaded=0; + }else if(state==2&&mc.currentScreen instanceof MainMenuScreen&&!stopping.getExecutionThread().isAlive()){ + mc.launchIntegratedServer("modernmetals-smoke","Modern Metals 1.14 smoke",null);state=3;ticks=0; + }else if(state==3&&mc.world!=null&&mc.player!=null&&++loaded>80){ + stopping=mc.getIntegratedServer();mc.world.sendQuittingDisconnectingPacket();mc.loadWorld(null);mc.displayGuiScreen(new MainMenuScreen());state=4;ticks=0; + }else if(state==4&&!stopping.getExecutionThread().isAlive()){ + Files.write(Paths.get("client-probe.json"),("{\"status\":\"passed\",\"items\":"+ModContent.itemsById().size()+",\"ores\":20,\"worldReopened\":true}").getBytes(java.nio.charset.StandardCharsets.UTF_8));state=5;mc.shutdown(); + } + }catch(Throwable e){ + e.printStackTrace();try{Files.write(Paths.get("client-probe.json"),("{\"status\":\"failed\",\"failure\":\""+e.toString().replace("\"","'")+"\"}").getBytes(java.nio.charset.StandardCharsets.UTF_8));}catch(Exception ignored){}state=5;mc.shutdown(); + } + } + private static void validate(Minecraft mc){ + require(ModList.get().isLoaded("basemetals")==Boolean.getBoolean("modernmetalsclientprobe.expectBase"),"Expected Base Metals installation"); + String siblings=System.getProperty("modernmetalsclientprobe.expectedSiblings"); + if(siblings!=null){ + Set expected=new HashSet<>(Arrays.asList(siblings.split(","))); + for(String mod:new String[]{"basemetals","basegems","baseminerals"})require(ModList.get().isLoaded(mod)==expected.contains(mod),"Exact sibling combination: "+mod); + System.out.println("MODERN_PROFILE_CHECK PASS siblings="+siblings); + } + Screen parent=mc.currentScreen; + Screen config=ModList.get().getModContainerById("modernmetals").get().getCustomExtension(ExtensionPoint.CONFIGGUIFACTORY).get().apply(mc,parent); + require(config instanceof ModernMetalsConfigScreen,"Mods-list config factory"); + String original=ModernMetalsConfig.CONTENT_MODE.get(); + mc.displayGuiScreen(config);List