From 82849249bb3e35a60fa168098b708abca16dd580 Mon Sep 17 00:00:00 2001 From: JohnBraham Date: Mon, 30 Nov 2026 15:47:50 +0000 Subject: [PATCH] Bring Base Gems to Minecraft 1.16.5 --- .github/workflows/ci.yml | 14 +- .github/workflows/deploy-release.yml | 32 ++-- .github/workflows/release-on-tag.yml | 6 +- CHANGELOG.txt | 17 +- README.md | 26 +-- build.gradle | 10 +- docs/BUILDING.md | 26 +-- docs/MANUAL_TESTING.md | 23 ++- docs/MIGRATION.md | 21 ++- docs/PORTING_115.md | 2 +- docs/PORTING_116.md | 59 +++++++ docs/RELEASING.md | 14 +- gradle.properties | 20 +-- ...ty-115.gradle => compatibility-116.gradle} | 3 +- gradle/dependencies.json | 12 +- gradle/generate-resources.py | 2 +- ...115.gradle => local-companions-116.gradle} | 4 +- gradle/model-templates.json | 59 +++++-- ...{release-115.gradle => release-116.gradle} | 28 +-- gradle/release/artifacts.gradle | 10 +- ...ion-115.gradle => verification-116.gradle} | 2 +- .../basegems/testmod/BaseGemsClientProbe.java | 160 ++++++++++++------ .../testmod/CutoutOcclusionChecks.java | 109 ++++++++++++ .../resources/META-INF/mods.toml | 2 +- .../mc/basegems/testmod/BaseGemsProbe.java | 112 +++++++----- .../resources/META-INF/mods.toml | 2 +- .../zone/moddev/mc/basegems/BaseGems.java | 3 +- .../zone/moddev/mc/basegems/GemEvents.java | 34 ++-- .../mc/basegems/client/ClientSetup.java | 44 ++++- .../mc/basegems/client/GemConfigScreen.java | 36 ++-- .../client/MaterialProjectileRenderer.java | 2 +- .../content/CompatibilityDoubleSlabBlock.java | 2 +- .../mc/basegems/content/CrackhammerItem.java | 44 ++--- .../mc/basegems/content/GemAmmoItem.java | 2 +- .../moddev/mc/basegems/content/GemBlocks.java | 22 +-- .../moddev/mc/basegems/content/GemItems.java | 2 +- .../mc/basegems/content/MaterialBacked.java | 2 +- .../mc/basegems/content/MaterialItems.java | 82 ++++----- .../mc/basegems/content/MaterialTier.java | 18 +- .../mc/basegems/content/ModContent.java | 24 +-- .../mc/basegems/content/MoltenFluid.java | 46 ++--- .../mc/basegems/content/PlateBlock.java | 18 +- .../mc/basegems/content/RegistryHandle.java | 2 +- .../basegems/entity/MaterialProjectile.java | 24 +-- .../mc/basegems/entity/ModEntities.java | 8 +- .../basegems/migration/LegacyDoorStates.java | 12 +- .../migration/LegacyWorldDataHook.java | 134 ++++++++++----- .../network/GameplaySettingsNetwork.java | 6 +- .../recipe/ContentCraftingRecipe.java | 34 ++-- .../mc/basegems/recipe/CrushingRecipe.java | 28 +-- .../mc/basegems/recipe/GemBlastingRecipe.java | 26 +-- .../mc/basegems/recipe/GemSmeltingRecipe.java | 26 +-- .../mc/basegems/recipe/PlateRepairRecipe.java | 32 ++-- .../mc/basegems/worldgen/GemWorldgen.java | 8 +- src/main/resources/META-INF/mods.toml | 8 +- .../coremods/basegems_legacy_worlds.js | 13 +- src/main/resources/pack.mcmeta | 2 +- tools/{test_port_115.js => test_port_116.js} | 16 ++ 58 files changed, 981 insertions(+), 554 deletions(-) create mode 100644 docs/PORTING_116.md rename gradle/{compatibility-115.gradle => compatibility-116.gradle} (99%) rename gradle/{local-companions-115.gradle => local-companions-116.gradle} (92%) rename gradle/{release-115.gradle => release-116.gradle} (93%) rename gradle/{verification-115.gradle => verification-116.gradle} (98%) create mode 100644 src/clientIntegrationTest/java/zone/moddev/mc/basegems/testmod/CutoutOcclusionChecks.java rename tools/{test_port_115.js => test_port_116.js} (85%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fad27a5..b1ca351b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,16 @@ -name: Base Gems 1.15.2 CI +name: Base Gems 1.16.5 CI on: push: - branches: [master-1.15.2, 'feature/**'] + branches: [master-1.16.5, 'feature/**'] pull_request: - branches: [master-1.15.2] + branches: [master-1.16.5] permissions: contents: read concurrency: - group: basegems-115-${{ github.workflow }}-${{ github.ref }} + group: basegems-116-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -44,7 +44,7 @@ jobs: run: python3 gradle/stage-legacy-dependencies.py .gradle/legacy-dependencies - name: Build, audit and generate Eclipse launches run: | - bash ./gradlew clean check build javadoc verify115ReleaseArtifacts write115ReleaseChecksums prepareEclipse \ + bash ./gradlew clean check build javadoc verify116ReleaseArtifacts write116ReleaseChecksums prepareEclipse \ -PreleaseBuild=true -PlegacyDependencyVerificationRepository="$PWD/.gradle/legacy-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: BaseGems-1.15.2-${{ github.sha }} + name: BaseGems-1.16.5-${{ 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: BaseGems-1.15.2-diagnostics-${{ github.sha }} + name: BaseGems-1.16.5-diagnostics-${{ github.sha }} if-no-files-found: ignore retention-days: 14 path: | diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 55fe9682..b41ed6c3 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,15 +1,15 @@ -name: Release Base Gems 1.15.2 +name: Release Base Gems 1.16.5 run-name: Base Gems ${{ inputs.release_version }} (${{ inputs.confirm_live_publication && 'publish' || 'verify' }}) on: workflow_dispatch: inputs: release_version: - description: Four-part version for Minecraft 1.15.2 + description: Four-part version for Minecraft 1.16.5 required: true type: string release_commit: - description: Full SHA of the checked MMD master-1.15.2 commit + description: Full SHA of the checked MMD master-1.16.5 commit required: true type: string tested_jar_sha256: @@ -33,13 +33,13 @@ permissions: contents: read concurrency: - group: basegems-release-115 + group: basegems-release-116 cancel-in-progress: false jobs: qualify: name: Verify merged CI candidate - if: github.repository == 'MinecraftModDevelopmentMods/BaseGems' && github.ref == 'refs/heads/master-1.15.2' + if: github.repository == 'MinecraftModDevelopmentMods/BaseGems' && github.ref == 'refs/heads/master-1.16.5' 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]+\.115021$ ]] + [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.116051$ ]] [[ "$RELEASE_SHA" =~ ^[[:xdigit:]]{40}$ ]] [[ "$TESTED_SHA" =~ ^[[:xdigit:]]{64}$ ]] test "$(git rev-parse HEAD)" = "$RELEASE_SHA" - test "$(gh api "repos/$GITHUB_REPOSITORY/branches/master-1.15.2" --jq .commit.sha)" = "$RELEASE_SHA" + test "$(gh api "repos/$GITHUB_REPOSITORY/branches/master-1.16.5" --jq .commit.sha)" = "$RELEASE_SHA" grep -Fxq "mod_version=$RELEASE_VERSION" gradle.properties - grep -Fxq 'minecraft_version=1.15.2' gradle.properties + grep -Fxq 'minecraft_version=1.16.5' gradle.properties ci_run="$(gh api --method GET "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs" \ - -f branch=master-1.15.2 -f head_sha="$RELEASE_SHA" -f event=push -f status=success \ + -f branch=master-1.16.5 -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: BaseGems-1.15.2-${{ inputs.release_commit }} + name: BaseGems-1.16.5-${{ inputs.release_commit }} run-id: ${{ steps.candidate.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -152,7 +152,7 @@ jobs: - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: BaseGems-1.15.2-${{ inputs.release_commit }} + name: BaseGems-1.16.5-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -179,7 +179,7 @@ jobs: steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: BaseGems-1.15.2-${{ inputs.release_commit }} + name: BaseGems-1.16.5-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -192,12 +192,12 @@ jobs: with: curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} curseforge-id: '1793939' - name: Base Gems ${{ inputs.release_version }} for Minecraft 1.15.2 (Forge) + name: Base Gems ${{ inputs.release_version }} for Minecraft 1.16.5 (Forge) version: ${{ inputs.release_version }} version-type: ${{ inputs.curseforge_release_level }} changelog-file: ${{ runner.temp }}/release-input/CHANGELOG.txt loaders: forge - game-versions: '1.15.2' + game-versions: '1.16.5' game-version-filter: none environment: client | server java: Java 8 @@ -233,7 +233,7 @@ jobs: steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: BaseGems-1.15.2-${{ inputs.release_commit }} + name: BaseGems-1.16.5-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -246,5 +246,5 @@ jobs: set -euo pipefail sha256sum --check --strict SHA256SUMS gh release create "$RELEASE_VERSION" --repo "$GITHUB_REPOSITORY" --verify-tag \ - --title "Base Gems $RELEASE_VERSION for Minecraft 1.15.2 (Forge)" \ + --title "Base Gems $RELEASE_VERSION for Minecraft 1.16.5 (Forge)" \ --notes-file CHANGELOG.txt "BaseGems-$RELEASE_VERSION"{,-sources,-javadoc}.jar SHA256SUMS diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 8b4fcba5..acca54cf 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -1,7 +1,7 @@ -name: Validate Base Gems 1.15.2 tag +name: Validate Base Gems 1.16.5 tag on: push: - tags: ['*.*.*.115021'] + tags: ['*.*.*.116051'] 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.15.2' gradle.properties + grep -Fxq 'minecraft_version=1.16.5' gradle.properties echo 'Tag validated. Publication uses deploy-release.yml with explicit confirmation.' >> "$GITHUB_STEP_SUMMARY" diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4a9320e0..cf25c0d8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,12 +1,25 @@ +2.5.0.116051 for Minecraft 1.16.5 + +All 33 gems move across from the current 1.15.2 work, including the bars and +see-through door/trapdoor fixes. Use Java 8 and OreSpawn 4.1.7.116051. Base Metals 3.1.2.116051 and Modern Metals 3.0.0.116051 are optional. + +- Keeps the gem names, config keys, Fantasy modes and deposit distribution. +- Updates recipes, GUI rendering, fluids and save hooks for native 1.16 APIs. +- Converts older gem wall connections to the new wall states when upgrading saves. +- Keeps bow, crossbow, shield and fishing rod model animations on the new renderer. +- Retains mining requirements, Fortune, Silk Touch, XP, trades and recipe discovery. +- Ore overlays keep the wider gap and their explicit texture coordinates. + 2.5.0.115021 for Minecraft 1.15.2 Doors, trapdoors and bars no longer hide the terrain behind their gaps. Their placement and collision behaviour stay the same. +The local 1.15 candidate now uses vanilla bar post/cap connections for all 33 gems. Its optional local Base Metals and Modern Metals profiles use player/mapped hash pins. Run pinLocalCompanions after rebuilding the siblings, then regenerate Eclipse separately. No Modern Metals 1.15 Maven release is assumed. + All 33 gems move across from the 1.14.4 release, with the same names, config keys, recipes and deposit distribution. Use OreSpawn 4.1.7.115021 and Java 8; -Base Metals 3.0.3.115021 and Modern Metals 3.0.0.115021 are optional. -Bars connect like vanilla iron bars. +Base Metals 3.0.2.115021 is optional. - Ore overlays keep the wider spacing and explicit texture coordinates. - Gem ores, decorative blocks, molten gems and projectiles use native 1.15 rendering. diff --git a/README.md b/README.md index c8e7b1df..e7aa9e32 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Base Gems for Minecraft 1.15.2 +# Base Gems for Minecraft 1.16.5 Base Gems adds 33 gemstones to Minecraft. Mine agate and amethyst in upper caves, look deeper for ruby and sapphire, or head down near bedrock for black @@ -7,27 +7,27 @@ pieces, tools, weapons and shields. ## Installation -Use Java 8 and Forge **31.2.57 for Minecraft 1.15.2** on both client and +Use Java 8 and Forge **36.2.34 for Minecraft 1.16.5** on both client and server. Base Gems needs MMD OreSpawn and runs without MMDLib. -Use [MMD OreSpawn 4.1.7.115021](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.115021) -or a later compatible 1.15.2 release. It includes the fix for checking cave air -at generation boundaries; no separate local engine is needed. +Use [OreSpawn 4.1.7.116051](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.116051) +or a later compatible 1.16.5 release. OreSpawn owns the deposits; Base Gems +does not add a separate generator. Base Metals is optional for a new world. When installed together, use -[Base Metals 3.0.3.115021](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.0.3.115021) -or a later compatible 1.15.2 release. If your old +[Base Metals 3.1.2.116051](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.1.2.116051) +or a later compatible 1.16.5 release. If your old world contains Base Metals blocks or items, keep it installed for the upgrade. Gem crushing works with the Base Gems crackhammer on its own. With Base -Metals installed its tools and crushers can use the same recipes. [Modern Metals 3.0.0.115021](https://github.com/MinecraftModDevelopmentMods/ModernMetals/releases/tag/3.0.0.115021) -also supplies shared crushing when installed. +Metals installed its tools and crushers can use the same recipes. [Modern Metals 3.0.0.116051](https://github.com/MinecraftModDevelopmentMods/ModernMetals/releases/tag/3.0.0.116051) +can supply shared crushing when Base Metals is absent. ## Upgrading a world -Make a separate copy before opening a 1.14.4 world in 1.15.2. Keep the +Make a separate copy before opening a 1.15.2 world in 1.16.5. Keep the whole save, including `basegems-legacy-registry.dat` if it is present. Worlds -from 1.10–1.12 should first go through the released Base Gems 1.13.2 upgrade. +from 1.10–1.12 should first go through the released Base Gems 1.13.2 upgrade. [World upgrade details](docs/MIGRATION.md) ## Mining and trading @@ -86,9 +86,9 @@ upgrade recipes are not part of this port. ## Development and credits -The 1.15.2 branch uses ForgeGradle 7 and builds a Java 8 mod. +The 1.16.5 branch uses ForgeGradle 7 and builds a Java 8 mod. See [building and Eclipse setup](docs/BUILDING.md) and the -[manual testing](docs/MANUAL_TESTING.md), [porting notes](docs/PORTING_115.md) +[manual testing](docs/MANUAL_TESTING.md), [porting notes](docs/PORTING_116.md) and the [changelog](CHANGELOG.txt). The gem artwork comes from the 1.12.2 branch. Thanks to Aedda, Eejit, diff --git a/build.gradle b/build.gradle index 839e9ad7..6af030ad 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,8 @@ group = project.mod_group version = project.mod_version base.archivesName = 'BaseGems' -if (!(project.version ==~ /\d+\.\d+\.\d+\.115021/)) { - throw new GradleException('Use Major.Minor.Patch.115021 for Minecraft 1.15.2 on Forge.') +if (!(project.version ==~ /\d+\.\d+\.\d+\.116051/)) { + throw new GradleException('Use Major.Minor.Patch.116051 for Minecraft 1.16.5 on Forge.') } // Gradle and Mavenizer use modern JDKs; the mod and game still use Java 8. @@ -190,9 +190,9 @@ tasks.register('verifyFluidRegistration', Exec) { } tasks.named('check') { dependsOn 'verifyFluidRegistration' } -apply from: 'gradle/release-115.gradle' +apply from: 'gradle/release-116.gradle' apply from: 'gradle/normalize-javadoc-trees.gradle' -apply from: 'gradle/verification-115.gradle' -apply from: 'gradle/compatibility-115.gradle' +apply from: 'gradle/verification-116.gradle' +apply from: 'gradle/compatibility-116.gradle' diff --git a/docs/BUILDING.md b/docs/BUILDING.md index f36f5d93..94f09776 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -1,4 +1,4 @@ -# Building Base Gems for Minecraft 1.15.2 +# Building Base Gems for Minecraft 1.16.5 Use Java 17 to run Gradle 9.6.1, Java 25 for ForgeGradle's Mavenizer, and Java 8 for compilation and Minecraft. Put Java 17 on your command path and @@ -20,18 +20,18 @@ From the inner Git checkout on Windows: ```powershell python gradle/stage-legacy-dependencies.py .gradle/legacy-dependencies -.\gradlew.bat check build verify115ReleaseArtifacts write115ReleaseChecksums prepareEclipse +.\gradlew.bat check build verify116ReleaseArtifacts write116ReleaseChecksums prepareEclipse ``` On Linux or macOS, use `python3` and `./gradlew`. The game jar is -`build/libs/BaseGems-2.5.0.115021.jar`. The build uses Forge 31.2.57 and -MCP snapshot 20200514-1.15.1. Model, recipe, tag, language and advancement data +`build/libs/BaseGems-2.5.0.116051.jar`. The build uses Forge 36.2.34 and +official 1.16.5 mappings. Model, recipe, tag, language and advancement data is generated during resource processing. `prepareEclipse` generates the Eclipse project and Java 8 launches with processed resources and the pinned runtime dependencies. Use the same Gradle cache for Eclipse and command-line builds. -The optional metal integration uses published Base Metals 3.0.3.115021 and Modern Metals 3.0.0.115021. +The optional metal integration uses the published Base Metals 3.1.2.116051 and Modern Metals 3.0.0.116051. Run `prepareEclipse` again after changing sources or resources. Use a fresh test world when checking the OreSpawn defaults. In Low @@ -39,18 +39,20 @@ Fantasy, try mining and trading a gem, then check that storage blocks are still craftable and equipment recipes have gone. See [ore generation](ORE_GENERATION.md) for the placement rules and config overrides. -`prepareEclipse` generates standalone, Base Metals, Modern Metals and combined client profiles. Each has its own run folder. Replaced +`prepareEclipse` generates standalone, Base Metals, Modern Metals and combined +clients. Each has its own run folder. Replaced companion jars are retained under `.gradle/retired-compatibility-jars`; saves, config and unrelated mods are preserved. -After building the sibling metal projects, run `pinLocalCompanions`, then -`prepareEclipse` in a separate invocation to test local builds of the companion mods. -Both local player and mapped jars are hash-checked; a stale pin stops refresh. -The selected local Base Metals includes the bars and ore-overlay corrections. -Release mode ignores automatic local pins and rejects an explicit local override. +The local companion hooks remain available for future target-native builds. +A local override must be pinned by player and mapped SHA-256 and is rejected +in release mode. The published dependencies supply both companion profiles. +Use `D:/GradleCaches/minecraft-mods-shared` for this checkout in both Eclipse +and the terminal, matching the existing Base Metals 1.16 setup. Older version +ports use a different cache and must not write into this one concurrently. `runProbeServer` and `runProbeClient` are explicit automated checks. Use a new `-PprobeDirectory=run/verification/` for each scenario and keep their receipts. Ordinary launches exclude these test mods. -See [manual testing](MANUAL_TESTING.md) and [porting notes](PORTING_115.md). +See [manual testing](MANUAL_TESTING.md) and [porting notes](PORTING_116.md). diff --git a/docs/MANUAL_TESTING.md b/docs/MANUAL_TESTING.md index 9b0c8836..e4a76b9f 100644 --- a/docs/MANUAL_TESTING.md +++ b/docs/MANUAL_TESTING.md @@ -1,14 +1,17 @@ -# Testing Base Gems 1.15.2 +# Testing Base Gems 1.16.5 -Use Java 8, Forge 31.2.57 and OreSpawn 4.1.7.115021. The game jar is -`build/libs/BaseGems-2.5.0.115021.jar`. Base Metals 3.0.3.115021 is optional. +Use Java 8, Forge 36.2.34 and OreSpawn 4.1.7.116051. The game jar is +`build/libs/BaseGems-2.5.0.116051.jar`. Base Metals 3.1.2.116051 is optional. -Build the siblings, run `pinLocalCompanions`, then run `prepareEclipse` separately. Choose a normal launch: +Run `prepareEclipse` and choose a normal launch: - `runClient.launch`: Base Gems and OreSpawn. -- `runClientWithBaseMetals.launch`: adds the selected Base Metals candidate. -- `runClientWithModernMetals.launch`: adds the pinned Modern Metals build. -- `runClientWithBaseAndModern.launch`: adds both pinned metal candidates. +- `runClientWithBaseMetals.launch`: adds published Base Metals 3.1.2.116051. +- `runClientWithModernMetals.launch`: adds published Modern Metals 3.0.0.116051. +- `runClientWithBaseAndModern.launch`: adds both metal mods. + +Pin the player and mapped jars before regenerating Eclipse with a local +companion override. Use the matching versions in a separate launcher instance if testing packaged jars. Avoid duplicate copies of the same mod. @@ -47,3 +50,9 @@ Restore it and restart before reconnecting. Use a copy for world upgrades. Keep the legacy registry sidecar, then check placed gems, door states, inventories, buckets and worn equipment. Save, leave and reopen the copy. See [migration](MIGRATION.md). + +Check the bow and crossbow at each draw stage, shield blocking and the fishing +rod's cast model. 1.16 uses per-item model predicates for these. For a floor +trapdoor or a door against a wall, nearby stone should stay visible through +the holes, including when open or waterlogged. Connected bars should have +vanilla joins without overlapping centre posts or caps. diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md index ea5ac192..d5fbf246 100644 --- a/docs/MIGRATION.md +++ b/docs/MIGRATION.md @@ -1,14 +1,14 @@ -# Upgrading Base Gems worlds to 1.15.2 +# Upgrading Base Gems worlds to 1.16.5 -Close the game and copy the whole save. Install the 1.15.2 versions of Base +Close the game and copy the whole save. Install the 1.16.5 versions of Base Gems, OreSpawn and every other mod that owns blocks or items in the world. -Open the copy with Java 8 and Forge 31.2.57. Keep the original until you have +Open the copy with Java 8 and Forge 36.2.34. Keep the original until you have checked your builds and inventories. -For worlds from 1.10–1.12, first use released Base Gems 2.5.0.113021 on +For worlds from 1.10–1.12, first use released Base Gems 2.5.0.113021 on Minecraft 1.13.2. Keep `basegems-legacy-registry.dat` with that world when -moving on through 1.14 and 1.15, especially if some old chunks remain -unvisited. The 1.15 port retains the old block and item names, fluid and bucket +moving on through the supported intermediate versions, especially if some old chunks remain +unvisited. The 1.16 port retains the old block and item names, fluid and bucket IDs, named block states and the legacy snapshot reader. Both old double-slab blocks and ordinary slabs remain registered. @@ -17,5 +17,14 @@ region at once. Reopen the copy and check the places and inventories that matter to you. OreSpawn keeps its world profile; gem rules retain their old IDs, so upgrading does not create a second family of deposits. +Minecraft 1.16 gives walls separate low and tall connections. Base Gems +converts its older wall connections in chunks and saved item state tags, +keeping the wall post and waterlogging. Existing native 1.16 states stay as +they are. The rest of the gem block and item IDs carry over unchanged. + The focused test receipt records the copied world used for automated checks. It does not replace a backup or manual acceptance of your own modpack. + +On the first 1.15-to-1.16 load, Forge can report old vanilla registry entries +such as `minecraft:zombie_pigman` and villager memories. Those messages were +present in the automated upgrade fixture; none referred to Base Gems IDs. diff --git a/docs/PORTING_115.md b/docs/PORTING_115.md index 8cdedbdf..d1322a19 100644 --- a/docs/PORTING_115.md +++ b/docs/PORTING_115.md @@ -21,7 +21,7 @@ accessors. The config screens retain the target's matrix-free signatures. The save-format, chunk-loader and worldgen-protection coremod descriptors match the mapped 1.15 classes; their existing legacy conversion is retained. -Published dependencies: OreSpawn 4.1.7.115021 and optional Base Metals 3.0.3.115021. +Published dependencies: OreSpawn 4.1.7.115021 and optional Base Metals 3.0.2.115021. Their player jars are SHA-256 pinned. No Modern Metals 1.15.2 release is available, so it is omitted from dependency pins and manual profiles. diff --git a/docs/PORTING_116.md b/docs/PORTING_116.md new file mode 100644 index 00000000..cfa65907 --- /dev/null +++ b/docs/PORTING_116.md @@ -0,0 +1,59 @@ +# Minecraft 1.16.5 port + +The baseline is the exact local 1.15.2 source, including its later multipart +bars and non-occluding doors, trapdoors and bars. That source still shares +Git HEAD `87de48f` with the released 1.14.4 branch; its working tree was copied +and frozen separately rather than committed or discarded. The source checkout +and its worlds are preserved. + +Forge 36.2.34, official 1.16.5 mappings and MCP config 20210115.111550 match +the sibling Base Metals target. The official MDK SHA-1 is +`a5dce2043017c05efd0faae15532a7e004aa9e1f`. Gradle uses Java 17, Mavenizer +Java 25, and compilation/game Java 8. The existing ForgeGradle 7/Gradle 9 build +is retained. Resource/data pack format is 6. + +The build pins published OreSpawn 4.1.7.116051 and the optional Base Metals +3.1.2.116051 and Modern Metals 3.0.0.116051 companions by SHA-256. + +Registry IDs, configuration keys, gem properties and the OreSpawn provider +policy carry over. OreSpawn owns generation and the dynamic biome/feature +integration. Base Gems supplies declarations through its public API, with +no native or fallback generator. Existing rule IDs and retrogen-off policy +are retained. Ore geometry keeps the 0.05 model-unit overlay and explicit UVs. + +The port uses native recipe serializers, item/ingredient and packet APIs, +fluid states, MatrixStack GUI rendering and dimension RegistryKeys. Tool +requirements use the native correct-tool flag as well as the existing tiers. +Client model predicates are registered explicitly for the gem bows, +crossbows, shields and rods, using the corresponding vanilla predicates. +The save/coremod hooks target the 1.16 level-data codec and chunk upgrade +methods. Legacy sidecars remain available. Gem wall models use the new +none/low/tall connections; older chunk palettes and item state tags are +converted without changing native 1.16 states. + +The local build, resource checks and native clients pass, both standalone and +with published Base Metals. The client checks cover 1,089 item models, all +33 ore overlays, 198 item animation predicates and all 5,280 states of the +gem doors, trapdoors and bars. Both clients create, save and reopen a world. +These automated checks leave the visual and gameplay acceptance to manual +testing. + +Packaged server cases cover fresh generation, reopen, High and Low Fantasy, +disabled ruby and Base Metals integration. They exercise mining tiers, loot, +XP, trades, recipes, tag-based discovery, furnaces and dimension-correct +generation. A separate case upgrades a copy of the 1.15 fixture. Forge reports +the vanilla registry changes from that version, including zombie pigmen and +villager memories; the exact messages are retained and reviewed separately. +No Base Gems mappings are missing. + +The save comparator handles both pre-1.16 contiguous block storage and +1.16's padded long storage. It compares the meaning of converted wall +connections rather than treating valid native state conversion as a loss. +After upgrade, save and reopen, all 20,703 gem blocks and 1,128 gem item +stacks in the copied fixture match. The 46 source-world files are unchanged. +This is the tested fixture, rather than a claim about every possible modpack. + +References: [Forge's 1.16 porting guide](https://docs.minecraftforge.net/en/1.16.x/legacy/porting/), +[the linked 1.15-to-1.16 primer](https://gist.github.com/50ap5ud5/f4e70f0e8faeddcfde6b4b1df70f83b8), +[the Nether Update notes](https://www.minecraft.net/en-us/article/nether-update-java), +and the exact mapped Forge 36 classes. diff --git a/docs/RELEASING.md b/docs/RELEASING.md index aa57d079..24342d76 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,16 +1,16 @@ -# Releasing Base Gems for Minecraft 1.15.2 +# Releasing Base Gems for Minecraft 1.16.5 Build with Java 17, Temurin 8u502-b07 for compilation and Java 25 for -Mavenizer. Run check, build, verify115ReleaseArtifacts, -write115ReleaseChecksums, genEclipseRuns and eclipse. Keep the packaged +Mavenizer. Run check, build, verify116ReleaseArtifacts, +write116ReleaseChecksums, 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.15.2`. After merging, wait for the -successful push CI run and download BaseGems-1.15.2-. Compare +Open a PR from the fork to MMD's `master-1.16.5`. After merging, wait for the +successful push CI run and download BaseGems-1.16.5-. 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.15.2 with the release version, full merged +Run deploy-release.yml on master-1.16.5 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.15.2 release. +and keep the compatibility pins on the public Base Metals and Modern Metals releases. diff --git a/gradle.properties b/gradle.properties index ebf0d56e..8aee22e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,13 +4,13 @@ org.gradle.configuration-cache=false org.gradle.caching=true org.gradle.parallel=false net.minecraftforge.gradle.merge-source-sets=false -minecraft_version=1.15.2 -forge_version=31.2.57 -mappings_channel=snapshot -mappings_version=20200514-1.15.1 +minecraft_version=1.16.5 +forge_version=36.2.34 +mappings_channel=official +mappings_version=1.16.5 mod_id=basegems mod_group=zone.moddev.mc.basegems -mod_version=2.5.0.115021 +mod_version=2.5.0.116051 mod_artifact=BaseGems loader_name=forge loader_code=1 @@ -20,10 +20,10 @@ java_setup_version=8.0.502+7 gradle_java_version=17 gradle_java_setup_version=17.0.1+12 mavenizer_java_version=25.0.3+9 -orespawn_version=4.1.7.115021 -orespawn_version_range=[4.1.7.115021,5.0.0) -mcp_version=20200515.085601 +orespawn_version=4.1.7.116051 +orespawn_version_range=[4.1.0.116051,5.0.0) +mcp_version=20210115.111550 -basemetals_version=3.0.3.115021 +basemetals_version=3.1.2.116051 -modernmetals_version=3.0.0.115021 +modernmetals_version=3.0.0.116051 diff --git a/gradle/compatibility-115.gradle b/gradle/compatibility-116.gradle similarity index 99% rename from gradle/compatibility-115.gradle rename to gradle/compatibility-116.gradle index 750c69fe..11c9eef8 100644 --- a/gradle/compatibility-115.gradle +++ b/gradle/compatibility-116.gradle @@ -6,7 +6,7 @@ import java.nio.file.StandardCopyOption import java.security.MessageDigest import java.util.zip.ZipFile -apply from: 'gradle/local-companions-115.gradle' +apply from: 'gradle/local-companions-116.gradle' def basePin = localCompanionPins.basemetals def modernPin = localCompanionPins.modernmetals @@ -21,7 +21,6 @@ dependencies { baseMetalsDevelopment (basePin.enabled ? files(file(basePin.pin.mappedJar)) : renamer.dependency(published.basemetals.coordinate)) if (haveModern) modernMetalsDevelopment (modernPin.enabled ? files(file(modernPin.pin.mappedJar)) : renamer.dependency(published.modernmetals.coordinate)) } - def profiles = [Standalone: ['', []], WithBaseMetals: ['with-basemetals', ['base']]] if (haveModern) { profiles.WithModernMetals = ['with-modernmetals', ['modern']] diff --git a/gradle/dependencies.json b/gradle/dependencies.json index 96a4a4af..7a540c8a 100644 --- a/gradle/dependencies.json +++ b/gradle/dependencies.json @@ -1,23 +1,23 @@ [ { "id": "orespawn", - "coordinate": "zone.moddev.mc.orespawn:OreSpawn:4.1.7.115021", + "coordinate": "zone.moddev.mc.orespawn:OreSpawn:4.1.7.116051", "repository": "https://maven.moddev.zone/releases", - "sha256": "5CDF25E6D98560CBEF8366D6D1589B66E99A386859E5D659ACBB2B806FCF8F3D", + "sha256": "310022CCDA2C6A4D118F94C72838ACC8020C2F594F2E93754DC19D2644B8E9FC", "runtime": true }, { "id": "basemetals", - "coordinate": "zone.moddev.mc.basemetals:BaseMetals:3.0.3.115021", + "coordinate": "zone.moddev.mc.basemetals:BaseMetals:3.1.2.116051", "repository": "https://maven.moddev.zone/releases", - "sha256": "5C7CF937C10D1F131E2716D6242B1B56EEBE051CF8F1B267AA78E6B9AD6784C1", + "sha256": "1816919FEF35908AB42F5F4C32AA05E9DF3255AE9090AA83AB14F232591DA046", "runtime": false }, { "id": "modernmetals", - "coordinate": "zone.moddev.mc.modernmetals:ModernMetals:3.0.0.115021", + "coordinate": "zone.moddev.mc.modernmetals:ModernMetals:3.0.0.116051", "repository": "https://maven.moddev.zone/releases", "runtime": false, - "sha256": "CE6F05F9561CA9621765DC13FE63B24228ACAE2D33CE9968F8EE8F24F899AD7C" + "sha256": "3F6F869A1B385C514F538FCD03A163CE6551A484CE6EA5DCBA0BDBCD410650B3" } ] diff --git a/gradle/generate-resources.py b/gradle/generate-resources.py index 8ca48a6f..647cde49 100644 --- a/gradle/generate-resources.py +++ b/gradle/generate-resources.py @@ -1,4 +1,4 @@ -"""Translate the legacy art and build the data pack for Forge 31.""" +"""Translate the legacy art and build the data pack for Forge 36.""" from pathlib import Path import json diff --git a/gradle/local-companions-115.gradle b/gradle/local-companions-116.gradle similarity index 92% rename from gradle/local-companions-115.gradle rename to gradle/local-companions-116.gradle index abc9ef3f..ac8727ab 100644 --- a/gradle/local-companions-115.gradle +++ b/gradle/local-companions-116.gradle @@ -5,8 +5,8 @@ import java.security.MessageDigest // Local candidates are selected by hash. Release builds keep published dependencies. def releaseBuild = providers.gradleProperty('releaseBuild').map { it.toBoolean() }.orElse(false).get() def definitions = [ - basemetals: [label: 'BaseMetals', version: '3.0.3.115021', checkout: '../../BaseMetals 115/BaseMetals', property: 'baseMetalsCheckout'], - modernmetals: [label: 'ModernMetals', version: '3.0.0.115021', checkout: '../../ModernMetals 115/ModernMetals', property: 'modernMetalsCheckout'] + basemetals: [label: 'BaseMetals', version: '3.1.2.116051', checkout: '../../BaseMetals 116/BaseMetals', property: 'baseMetalsCheckout'], + modernmetals: [label: 'ModernMetals', version: '3.0.0.116051', checkout: '../../ModernMetals 116/ModernMetals', property: 'modernMetalsCheckout'] ] def hash = { File jar -> MessageDigest.getInstance('SHA-256').digest(jar.bytes).encodeHex().toString() } def pins = [:] diff --git a/gradle/model-templates.json b/gradle/model-templates.json index 38133af6..a1744268 100644 --- a/gradle/model-templates.json +++ b/gradle/model-templates.json @@ -770,7 +770,7 @@ }, { "when": { - "north": "true" + "north": "low" }, "apply": { "model": "basegems:block/{gem}_wall_side", @@ -779,32 +779,71 @@ }, { "when": { - "east": "true" + "north": "tall" }, "apply": { - "model": "basegems:block/{gem}_wall_side", - "y": 90, + "model": "basegems:block/{gem}_wall_side_tall", "uvlock": true } }, { "when": { - "south": "true" + "east": "low" }, "apply": { "model": "basegems:block/{gem}_wall_side", - "y": 180, - "uvlock": true + "uvlock": true, + "y": 90 } }, { "when": { - "west": "true" + "east": "tall" + }, + "apply": { + "model": "basegems:block/{gem}_wall_side_tall", + "uvlock": true, + "y": 90 + } + }, + { + "when": { + "south": "low" }, "apply": { "model": "basegems:block/{gem}_wall_side", - "y": 270, - "uvlock": true + "uvlock": true, + "y": 180 + } + }, + { + "when": { + "south": "tall" + }, + "apply": { + "model": "basegems:block/{gem}_wall_side_tall", + "uvlock": true, + "y": 180 + } + }, + { + "when": { + "west": "low" + }, + "apply": { + "model": "basegems:block/{gem}_wall_side", + "uvlock": true, + "y": 270 + } + }, + { + "when": { + "west": "tall" + }, + "apply": { + "model": "basegems:block/{gem}_wall_side_tall", + "uvlock": true, + "y": 270 } } ] diff --git a/gradle/release-115.gradle b/gradle/release-116.gradle similarity index 93% rename from gradle/release-115.gradle rename to gradle/release-116.gradle index ed1dcc73..485dd2a1 100644 --- a/gradle/release-115.gradle +++ b/gradle/release-116.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.15.2-forge-31.2.57-java-8') + 'Build-Target': 'minecraft-1.16.5-forge-36.2.34-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+\.115021/)) { + if (project.group.toString() != expectedGroup || !(project.version.toString() ==~ /\d+\.\d+\.\d+\.116051/)) { 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,8 @@ 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.15.2]"') - || !metadata.contains('versionRange="[4.1.7.115021,5.0.0)"')) { + || !metadata.contains('versionRange="[1.16.5]"') + || !metadata.contains('versionRange="[4.1.0.116051,5.0.0)"')) { throw new GradleException('Wrong or unresolved release mod metadata') } } @@ -85,14 +85,14 @@ def audit = { File directory -> } } -tasks.register('verify115ReleaseArtifacts') { +tasks.register('verify116ReleaseArtifacts') { group = 'verification' dependsOn tasks.named('assemble'), tasks.named('check') doLast { audit(layout.buildDirectory.dir('libs').get().asFile) } } -tasks.register('write115ReleaseChecksums') { +tasks.register('write116ReleaseChecksums') { group = 'verification' - dependsOn tasks.named('verify115ReleaseArtifacts') + dependsOn tasks.named('verify116ReleaseArtifacts') doLast { File output = layout.buildDirectory.file('release/SHA256SUMS').get().asFile output.parentFile.mkdirs() @@ -101,7 +101,7 @@ tasks.register('write115ReleaseChecksums') { }.join('\n') + '\n', 'UTF-8') } } -tasks.register('verify115PreparedReleaseArtifacts') { +tasks.register('verify116PreparedReleaseArtifacts') { group = 'verification' doLast { if (!preparedDirectory.isPresent()) throw new GradleException('preparedReleaseDir is required') @@ -145,7 +145,7 @@ publishing { } pom { name = 'Base Gems' - description = 'Base Gems for Minecraft 1.15.2, using Forge 31 and OreSpawn 4.' + description = 'Base Gems for Minecraft 1.16.5, using Forge 36 and OreSpawn 4.' url = 'https://github.com/MinecraftModDevelopmentMods/BaseGems' licenses { license { @@ -183,7 +183,7 @@ publishing { } } } -tasks.register('verify115MavenCoordinates') { +tasks.register('verify116MavenCoordinates') { dependsOn 'generatePomFileForMavenJavaPublication' doLast { def pom = new XmlSlurper(false, false).parse(layout.buildDirectory.file('publications/mavenJava/pom-default.xml').get().asFile) @@ -197,14 +197,14 @@ tasks.register('verify115MavenCoordinates') { throw new GradleException('Maven metadata must pin the optional released ' + name + ' dependency') } if (!pom.dependencies.dependency.any { it.artifactId.text() == 'OreSpawn' && it.version.text() == project.orespawn_version } - || !pom.dependencies.dependency.any { it.artifactId.text() == 'BaseMetals' && it.version.text() == '3.0.3.115021' && it.optional.text() == 'true' }) { + || !pom.dependencies.dependency.any { it.artifactId.text() == 'BaseMetals' && it.version.text() == '3.1.2.116051' && it.optional.text() == 'true' }) { throw new GradleException('Wrong published dependency versions') } } } tasks.withType(PublishToMavenRepository).configureEach { - dependsOn 'verify115MavenCoordinates' - dependsOn preparedDirectory.isPresent() ? 'verify115PreparedReleaseArtifacts' : 'verify115ReleaseArtifacts' + dependsOn 'verify116MavenCoordinates' + dependsOn preparedDirectory.isPresent() ? 'verify116PreparedReleaseArtifacts' : 'verify116ReleaseArtifacts' doFirst { def url = providers.environmentVariable('MAVEN_UPLOAD_URL').getOrElse('') if (!url.startsWith('https://') || url.startsWith('https://invalid.invalid') @@ -215,4 +215,4 @@ tasks.withType(PublishToMavenRepository).configureEach { } } -tasks.named('check') { dependsOn 'verify115MavenCoordinates' } +tasks.named('check') { dependsOn 'verify116MavenCoordinates' } diff --git a/gradle/release/artifacts.gradle b/gradle/release/artifacts.gradle index 5d848adf..601f2000 100644 --- a/gradle/release/artifacts.gradle +++ b/gradle/release/artifacts.gradle @@ -38,10 +38,10 @@ tasks.register('verifyReleaseConfiguration') { group = 'verification' dependsOn tasks.named('verifyJava8Toolchain') doLast { - if (project.group != 'zone.moddev.mc.basegems' || project.version != '2.5.0.115021' - || project.minecraft_version != '1.15.2' || project.forge_version != '31.2.57' - || project.mappings_channel != 'snapshot' || project.mappings_version != '20200514-1.15.1' - || project.orespawn_version != '4.1.7.115021') { + if (project.group != 'zone.moddev.mc.basegems' || project.version != '2.5.0.116051' + || project.minecraft_version != '1.16.5' || project.forge_version != '36.2.34' + || project.mappings_channel != 'official' || project.mappings_version != '1.16.5' + || project.orespawn_version != '4.1.7.116051') { throw new GradleException('Base Gems target, mappings or dependency pin changed.') } } @@ -105,7 +105,7 @@ def auditJars = { File directory -> } def info = zip.getInputStream(zip.getEntry('META-INF/mods.toml')).getText('UTF-8') if (!info.contains('modId="basegems"') || !info.contains('version="' + project.version + '"') - || !info.contains('versionRange="[1.15.2]"')) { + || !info.contains('versionRange="[1.16.5]"')) { throw new GradleException('Incorrect processed mods.toml.') } if (zip.getEntry('zone/moddev/mc/basegems/BaseGems.class') == null) { diff --git a/gradle/verification-115.gradle b/gradle/verification-116.gradle similarity index 98% rename from gradle/verification-115.gradle rename to gradle/verification-116.gradle index 9df5e72e..c762cff2 100644 --- a/gradle/verification-115.gradle +++ b/gradle/verification-116.gradle @@ -73,7 +73,7 @@ tasks.named('check') { dependsOn 'integrationTestClasses', 'clientIntegrationTes tasks.register('verifyPortResources', Exec) { group = 'verification' dependsOn 'generateGemResources' - commandLine 'node', '--test', 'tools/test_port_115.js', 'tools/test_bar_models.js' + commandLine 'node', '--test', 'tools/test_port_116.js', 'tools/test_bar_models.js' } tasks.named('check') { dependsOn 'verifyPortResources' } diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/basegems/testmod/BaseGemsClientProbe.java b/src/clientIntegrationTest/java/zone/moddev/mc/basegems/testmod/BaseGemsClientProbe.java index a22d41be..eb80ea78 100644 --- a/src/clientIntegrationTest/java/zone/moddev/mc/basegems/testmod/BaseGemsClientProbe.java +++ b/src/clientIntegrationTest/java/zone/moddev/mc/basegems/testmod/BaseGemsClientProbe.java @@ -30,11 +30,11 @@ public final class BaseGemsClientProbe { if(event.phase!=TickEvent.Phase.END||state==5)return; Minecraft mc=Minecraft.getInstance(); try{ - if(ticks%200==0)System.out.println("BASEGEMS_CLIENT_STAGE "+state+" screen="+(mc.currentScreen==null?"null":mc.currentScreen.getClass().getName())); - if(mc.currentScreen instanceof net.minecraftforge.fml.client.gui.screen.LoadingErrorScreen){ + if(ticks%200==0)System.out.println("BASEGEMS_CLIENT_STAGE "+state+" screen="+(mc.screen==null?"null":mc.screen.getClass().getName())); + if(mc.screen instanceof net.minecraftforge.fml.client.gui.screen.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)){ + for(java.lang.reflect.Field f:mc.screen.getClass().getDeclaredFields())if(java.util.List.class.isAssignableFrom(f.getType())){ + f.setAccessible(true);for(Object message:(java.util.List)f.get(mc.screen)){ if(message instanceof net.minecraftforge.fml.ModLoadingWarning)details.append(((net.minecraftforge.fml.ModLoadingWarning)message).formatToString()); else details.append(message); } @@ -42,100 +42,156 @@ public final class BaseGemsClientProbe { 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){ + if(state==0&&mc.screen instanceof MainMenuScreen){ validate(mc); - mc.launchIntegratedServer("basegems-smoke","Base Gems 1.15 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){ + createWorld(mc);state=1;ticks=0; + }else if(state==1&&mc.level!=null&&mc.player!=null&&++loaded>80){ validateWorldRendering(mc); - 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("basegems-smoke","Base Gems 1.15 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.items().size()+",\"ores\":33,\"worldReopened\":true}").getBytes(java.nio.charset.StandardCharsets.UTF_8));state=5;mc.shutdown(); + stopping=mc.getSingleplayerServer();mc.level.disconnect();mc.setLevel(null);mc.setScreen(new MainMenuScreen());state=2;ticks=0;loaded=0; + }else if(state==2&&mc.screen instanceof MainMenuScreen&&!stopping.getRunningThread().isAlive()){ + mc.loadLevel("basegems-smoke");state=3;ticks=0; + }else if(state==3&&mc.level!=null&&mc.player!=null&&++loaded>80){ + stopping=mc.getSingleplayerServer();mc.level.disconnect();mc.setLevel(null);mc.setScreen(new MainMenuScreen());state=4;ticks=0; + }else if(state==4&&!stopping.getRunningThread().isAlive()){ + Files.write(Paths.get("client-probe.json"),("{\"status\":\"passed\",\"items\":"+ModContent.items().size()+",\"ores\":33,\"worldReopened\":true}").getBytes(java.nio.charset.StandardCharsets.UTF_8));state=5;mc.stop(); } }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(); + 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.stop(); } } + private static void createWorld(Minecraft mc) { + net.minecraft.util.registry.DynamicRegistries.Impl registries = net.minecraft.util.registry.DynamicRegistries.builtin(); + java.util.Properties properties = new java.util.Properties(); + properties.setProperty("level-seed", "24112026"); + net.minecraft.world.gen.settings.DimensionGeneratorSettings generator = + net.minecraft.world.gen.settings.DimensionGeneratorSettings.create(registries, properties); + mc.createLevel("basegems-smoke", new WorldSettings("Base Gems 1.16 smoke", GameType.CREATIVE, false, + net.minecraft.world.Difficulty.NORMAL, true, new net.minecraft.world.GameRules(), + net.minecraft.util.datafix.codec.DatapackCodec.DEFAULT), registries, generator); + } + private static void validateWorldRendering(Minecraft mc) { for (net.minecraft.entity.EntityType type : Arrays.asList(zone.moddev.mc.basegems.entity.ModEntities.CUSTOM_ARROW.get(), zone.moddev.mc.basegems.entity.ModEntities.CUSTOM_BOLT.get())) { - zone.moddev.mc.basegems.entity.MaterialProjectile projectile = type.create(mc.world); - require(projectile != null && mc.getRenderManager().getRenderer(projectile) + zone.moddev.mc.basegems.entity.MaterialProjectile projectile = type.create(mc.level); + require(projectile != null && mc.getEntityRenderDispatcher().getRenderer(projectile) instanceof zone.moddev.mc.basegems.client.MaterialProjectileRenderer, "Native projectile renderer " + type.getRegistryName()); } ModContent.blocks().forEach((name, block) -> { if (block instanceof net.minecraft.block.DoorBlock || block instanceof net.minecraft.block.TrapDoorBlock || block instanceof net.minecraft.block.PaneBlock) { - require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(block.getDefaultState(), - net.minecraft.client.renderer.RenderType.getCutoutMipped()), "Decorative cutout " + name); + require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(block.defaultBlockState(), + net.minecraft.client.renderer.RenderType.cutoutMipped()), "Decorative cutout " + name); } }); + validateItemProperties(mc); for (FluidContent fluid : ModContent.fluids().values()) { - require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.source().get().getDefaultState(), - net.minecraft.client.renderer.RenderType.getTranslucent()), "Source fluid render layer"); - require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.flowing().get().getDefaultState(), - net.minecraft.client.renderer.RenderType.getTranslucent()), "Flowing fluid render layer"); - require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.block().get().getDefaultState(), - net.minecraft.client.renderer.RenderType.getTranslucent()), "Fluid block render layer"); + require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.source().get().defaultFluidState(), + net.minecraft.client.renderer.RenderType.translucent()), "Source fluid render layer"); + require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.flowing().get().defaultFluidState(), + net.minecraft.client.renderer.RenderType.translucent()), "Flowing fluid render layer"); + require(net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(fluid.block().get().defaultBlockState(), + net.minecraft.client.renderer.RenderType.translucent()), "Fluid block render layer"); + } + } + private static void validateItemProperties(Minecraft mc) { + net.minecraft.entity.player.ServerPlayerEntity player = net.minecraftforge.common.util.FakePlayerFactory + .getMinecraft(mc.getSingleplayerServer().overworld()); + int checked = 0; + for (net.minecraft.item.Item item : ModContent.items().values()) { + String[] keys = item instanceof net.minecraft.item.BowItem ? new String[]{"pull", "pulling"} + : item instanceof net.minecraft.item.ShieldItem ? new String[]{"blocking"} + : item instanceof net.minecraft.item.FishingRodItem ? new String[]{"cast"} : new String[0]; + ItemStack stack = new ItemStack(item); + player.setItemInHand(net.minecraft.util.Hand.MAIN_HAND, stack); + for (String key : keys) { + net.minecraft.item.IItemPropertyGetter property = net.minecraft.item.ItemModelsProperties.getProperty(item, new ResourceLocation(key)); + require(property != null, "Missing item model property " + item.getRegistryName() + ":" + key); + require(property.call(stack, mc.level, null) == 0, "Inactive item property " + key); + if (key.equals("cast")) { + player.fishing = new net.minecraft.entity.projectile.FishingBobberEntity(player, player.getLevel(), 0, 0); + require(property.call(stack, mc.level, player) == 1, "Cast rod model"); + validateActiveItemModel(mc, stack, player); + player.fishing = null; + } else { + player.startUsingItem(net.minecraft.util.Hand.MAIN_HAND); + if (!key.equals("pull")) { + require(property.call(stack, mc.level, player) == 1, "Active item model property " + key); + validateActiveItemModel(mc, stack, player); + } + player.stopUsingItem(); + } + checked++; + } } + player.setItemInHand(net.minecraft.util.Hand.MAIN_HAND, ItemStack.EMPTY); + require(checked == 198, "All gem item model properties: " + checked); + try { Files.write(Paths.get("item-properties.json"), ("{\"status\":\"passed\",\"properties\":" + checked + "}").getBytes(java.nio.charset.StandardCharsets.UTF_8)); } + catch (java.io.IOException failure) { throw new RuntimeException(failure); } } + + private static void validateActiveItemModel(Minecraft mc, ItemStack stack, net.minecraft.entity.LivingEntity user) { + IBakedModel standby = mc.getItemRenderer().getItemModelShaper().getItemModel(stack); + IBakedModel active = mc.getItemRenderer().getModel(stack, mc.level, user); + require(active != standby && active != mc.getModelManager().getMissingModel(), + "Active model override " + stack.getItem().getRegistryName()); + } + private static void validate(Minecraft mc){ - Screen parent=mc.currentScreen; + try { CutoutOcclusionChecks.run(); } catch (Exception failure) { throw new RuntimeException(failure); } + Screen parent=mc.screen; Screen config=ModList.get().getModContainerById("basegems").get().getCustomExtension(ExtensionPoint.CONFIGGUIFACTORY).get().apply(mc,parent); require(config instanceof GemConfigScreen,"Mods-list config factory"); String original=GemConfig.configuredMode(); - mc.displayGuiScreen(config);List