From edcd1ff37490c7c21604b8c2dee4e1e32048aa94 Mon Sep 17 00:00:00 2001 From: JohnBraham Date: Mon, 30 Nov 2026 15:24:16 +0000 Subject: [PATCH] Bring Modern Metals to Minecraft 1.16.5 --- .github/workflows/ci.yml | 14 +- .github/workflows/codeql-analysis.yml | 4 +- .github/workflows/deploy-release.yml | 32 ++--- .github/workflows/release-on-tag.yml | 6 +- .github/workflows/validate-gradle-build.yml | 4 +- CHANGELOG.txt | 10 ++ README.md | 25 ++-- build.gradle | 18 +-- docs/PORTING_116.md | 17 +++ gradle.properties | 20 +-- ...radle => eclipse-compatibility-116.gradle} | 10 +- gradle/ore-models.gradle | 7 +- ...{release-115.gradle => release-116.gradle} | 26 ++-- gradle/stage-release-dependencies.sh | 2 +- .../modernmetals/testmod/BarModelChecks.java | 24 ++-- .../testmod/CutoutOcclusionChecks.java | 33 +++-- .../testmod/ModernMetalsClientProbe.java | 132 +++++++++++------- .../resources/META-INF/mods.toml | 4 +- .../testmod/ModernMetalsProbe.java | 46 +++--- .../modernmetals/testmod/Native115Checks.java | 24 ++-- .../testmod/OrePlacementChecks.java | 14 +- .../testmod/ProcessingChecks.java | 54 +++---- .../mc/modernmetals/testmod/RangedChecks.java | 103 +++++++------- .../mc/modernmetals/testmod/StackChecks.java | 26 ++-- .../testmod/WorldUpgradeChecks.java | 16 +-- .../resources/META-INF/mods.toml | 4 +- .../zone/moddev/mc/modernmetals/ModTabs.java | 4 +- .../zone/moddev/mc/modernmetals/ModTags.java | 9 +- .../moddev/mc/modernmetals/ModernMetals.java | 6 +- .../mc/modernmetals/client/ClientSetup.java | 45 +++++- .../client/MaterialProjectileRenderer.java | 2 +- .../client/ModernMetalsConfigScreen.java | 23 +-- .../modernmetals/content/CrackhammerItem.java | 62 ++++---- .../modernmetals/content/LegacyRegistry.java | 2 +- .../modernmetals/content/MaterialArmor.java | 19 ++- .../modernmetals/content/MaterialBacked.java | 2 +- .../modernmetals/content/MaterialItems.java | 104 +++++++------- .../mc/modernmetals/content/MaterialTier.java | 20 ++- .../modernmetals/content/MetalAmmoItem.java | 2 +- .../mc/modernmetals/content/ModContent.java | 52 +++---- .../mc/modernmetals/content/MoltenFluid.java | 44 +++--- .../content/MoltenMetalBlock.java | 12 +- .../mc/modernmetals/content/PlateBlock.java | 18 +-- .../modernmetals/content/RegistryHandle.java | 2 +- .../mc/modernmetals/content/ScytheItem.java | 14 +- .../entity/MaterialProjectile.java | 26 ++-- .../mc/modernmetals/entity/ModEntities.java | 8 +- .../migration/LegacyDoorStates.java | 10 +- .../migration/LegacyWorldDataHook.java | 132 ++++++++++++------ .../network/ContentModeNetwork.java | 6 +- .../recipe/ContentCraftingRecipe.java | 34 ++--- .../modernmetals/recipe/CrushingRecipe.java | 26 ++-- .../recipe/LegacyBlastingRecipe.java | 36 ++--- .../recipe/LegacySmeltingRecipe.java | 36 ++--- .../recipe/NonEmptyTagCondition.java | 10 +- .../recipe/PlateRepairRecipe.java | 32 ++--- .../modernmetals/recipe/RecipeDiscovery.java | 34 +++-- src/main/resources/META-INF/coremods.json | 2 +- src/main/resources/META-INF/mods.toml | 10 +- .../blockstates/aluminum_wall.json | 47 ++++++- .../blockstates/aluminumbrass_wall.json | 47 ++++++- .../blockstates/beryllium_wall.json | 47 ++++++- .../modernmetals/blockstates/boron_wall.json | 47 ++++++- .../blockstates/cadmium_wall.json | 47 ++++++- .../blockstates/chromium_wall.json | 47 ++++++- .../blockstates/galvanizedsteel_wall.json | 47 ++++++- .../blockstates/iridium_wall.json | 47 ++++++- .../blockstates/magnesium_wall.json | 47 ++++++- .../blockstates/manganese_wall.json | 47 ++++++- .../blockstates/nichrome_wall.json | 47 ++++++- .../modernmetals/blockstates/osmium_wall.json | 47 ++++++- .../blockstates/plutonium_wall.json | 47 ++++++- .../modernmetals/blockstates/rutile_wall.json | 47 ++++++- .../blockstates/stainlesssteel_wall.json | 47 ++++++- .../blockstates/tantalum_wall.json | 47 ++++++- .../blockstates/thorium_wall.json | 47 ++++++- .../blockstates/titanium_wall.json | 47 ++++++- .../blockstates/tungsten_wall.json | 47 ++++++- .../blockstates/uranium_wall.json | 47 ++++++- .../blockstates/zirconium_wall.json | 47 ++++++- .../models/block/aluminum_wall_side_tall.json | 6 + .../block/aluminumbrass_wall_side_tall.json | 6 + .../block/beryllium_wall_side_tall.json | 6 + .../models/block/boron_wall_side_tall.json | 6 + .../models/block/cadmium_wall_side_tall.json | 6 + .../models/block/chromium_wall_side_tall.json | 6 + .../block/galvanizedsteel_wall_side_tall.json | 6 + .../models/block/iridium_wall_side_tall.json | 6 + .../block/magnesium_wall_side_tall.json | 6 + .../block/manganese_wall_side_tall.json | 6 + .../models/block/nichrome_wall_side_tall.json | 6 + .../models/block/osmium_wall_side_tall.json | 6 + .../block/plutonium_wall_side_tall.json | 6 + .../models/block/rutile_wall_side_tall.json | 6 + .../block/stainlesssteel_wall_side_tall.json | 6 + .../models/block/tantalum_wall_side_tall.json | 6 + .../models/block/thorium_wall_side_tall.json | 6 + .../models/block/titanium_wall_side_tall.json | 6 + .../models/block/tungsten_wall_side_tall.json | 6 + .../models/block/uranium_wall_side_tall.json | 6 + .../block/zirconium_wall_side_tall.json | 6 + ...y.js => modernmetals_116_compatibility.js} | 13 +- src/main/resources/pack.mcmeta | 2 +- tools/test_115_port.js | 4 +- tools/test_fluid_registration.js | 2 +- 105 files changed, 1871 insertions(+), 782 deletions(-) create mode 100644 docs/PORTING_116.md rename gradle/{eclipse-compatibility-115.gradle => eclipse-compatibility-116.gradle} (95%) rename gradle/{release-115.gradle => release-116.gradle} (93%) create mode 100644 src/main/resources/assets/modernmetals/models/block/aluminum_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/aluminumbrass_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/beryllium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/boron_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/cadmium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/chromium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/galvanizedsteel_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/iridium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/magnesium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/manganese_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/nichrome_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/osmium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/plutonium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/rutile_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/stainlesssteel_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/tantalum_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/thorium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/titanium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/tungsten_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/uranium_wall_side_tall.json create mode 100644 src/main/resources/assets/modernmetals/models/block/zirconium_wall_side_tall.json rename src/main/resources/coremods/{modernmetals_115_compatibility.js => modernmetals_116_compatibility.js} (88%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aba8383d..0449c6c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,16 @@ -name: Modern Metals 1.15.2 CI +name: Modern Metals 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: modernmetals-115-${{ github.workflow }}-${{ github.ref }} + group: modernmetals-116-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -44,7 +44,7 @@ jobs: run: bash gradle/stage-release-dependencies.sh .gradle/release-dependencies - name: Build, audit and generate Eclipse launches run: | - bash ./gradlew clean check build javadoc verify115ReleaseArtifacts write115ReleaseChecksums genEclipseRuns eclipse \ + bash ./gradlew clean check build javadoc verify116ReleaseArtifacts write116ReleaseChecksums 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.15.2-${{ github.sha }} + name: ModernMetals-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: ModernMetals-1.15.2-diagnostics-${{ github.sha }} + name: ModernMetals-1.16.5-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 b9786ed2..53f578d1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,11 +3,11 @@ name: CodeQL on: push: branches: - - master-1.15.2 + - master-1.16.5 - 'feature/**' pull_request: branches: - - master-1.15.2 + - master-1.16.5 schedule: - cron: '47 7 * * 4' diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 876f7f84..f00c20b6 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -1,15 +1,15 @@ -name: Release Modern Metals 1.15.2 +name: Release Modern Metals 1.16.5 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.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: modernmetals-release-115 + group: modernmetals-release-116 cancel-in-progress: false jobs: qualify: name: Verify merged CI candidate - if: github.repository == 'MinecraftModDevelopmentMods/ModernMetals' && github.ref == 'refs/heads/master-1.15.2' + if: github.repository == 'MinecraftModDevelopmentMods/ModernMetals' && 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: ModernMetals-1.15.2-${{ inputs.release_commit }} + name: ModernMetals-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: ModernMetals-1.15.2-${{ inputs.release_commit }} + name: ModernMetals-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: ModernMetals-1.15.2-${{ inputs.release_commit }} + name: ModernMetals-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: '244357' - name: Modern Metals ${{ inputs.release_version }} for Minecraft 1.15.2 (Forge) + name: Modern Metals ${{ 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 @@ -232,7 +232,7 @@ jobs: steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: ModernMetals-1.15.2-${{ inputs.release_commit }} + name: ModernMetals-1.16.5-${{ inputs.release_commit }} run-id: ${{ needs.qualify.outputs.ci_run }} github-token: ${{ github.token }} path: ${{ runner.temp }}/release-input @@ -245,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.15.2 (Forge)" \ + --title "Modern Metals $RELEASE_VERSION for Minecraft 1.16.5 (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 2d4ffba2..0cbed407 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -1,7 +1,7 @@ -name: Validate Modern Metals 1.15.2 tag +name: Validate Modern Metals 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/.github/workflows/validate-gradle-build.yml b/.github/workflows/validate-gradle-build.yml index 7d474847..fc66575a 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.15.2 + - master-1.16.5 - 'feature/**' pull_request: branches: - - master-1.15.2 + - master-1.16.5 permissions: contents: read diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1d6dde3c..63d7ac80 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,13 @@ +3.0.0.116051 for Minecraft 1.16.5 + +Modern Metals now runs on Forge 36.2.34. The 21 materials, alloy yields, +Fantasy Level and Base Metals crushing integration carry across from 1.15.2. +Ore overlays keep their spacing and transparent edges. Walls use the new short +and tall connections, with earlier saves converted when loaded. + +The Eclipse profiles cover all eight combinations of Base Metals, Base Gems +and Base Minerals. The build uses the published OreSpawn 4.1.7.116051 and optional Base Metals 3.1.2.116051. + 3.0.0.115021 for Minecraft 1.15.2 Doors, trapdoors and bars no longer hide the terrain behind their gaps. Their diff --git a/README.md b/README.md index 17128fa8..a6612c41 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Modern Metals for Minecraft 1.15.2 +# Modern Metals for Minecraft 1.16.5 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,15 +6,15 @@ building blocks. ## Installation -Use Java 8 and Forge **31.2.57** for Minecraft **1.15.2**. Install Modern -Metals and [OreSpawn 4.1.7.115021](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.115021) -on both the client and server. [Base Metals 3.0.3.115021](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.0.3.115021) +Use Java 8 and Forge **36.2.34** for Minecraft **1.16.5**. Install Modern +Metals and [OreSpawn 4.1.7.116051](https://github.com/MinecraftModDevelopmentMods/OreSpawn/releases/tag/4.1.7.116051) on both the client and server. +[Base Metals 3.1.2.116051](https://github.com/MinecraftModDevelopmentMods/BaseMetals/releases/tag/3.1.2.116051) 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. OreSpawn places the ores. Titanium ore is off by default; rutile and magnesium -still make titanium. Retrogen is off. This version follows vanilla 1.15 +still make titanium. Retrogen is off. This version follows vanilla 1.16.5 mining: pickaxes drop ore blocks, and crackhammers produce powders. Open **Mods → Modern Metals → Config**, or choose Modern Metals from the @@ -64,16 +64,17 @@ 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.15 port notes](docs/PORTING_115.md) for the port's checks. +and the [1.16.5 port notes](docs/PORTING_116.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 verify115ReleaseArtifacts 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. +Stage the published dependencies with +`bash gradle/stage-release-dependencies.sh .gradle/release-dependencies`. +Then run `gradlew build verify116ReleaseArtifacts genEclipseRuns eclipse`. +The build checks the published OreSpawn jar's SHA-256. Eclipse checks 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, @@ -88,7 +89,7 @@ Run Configurations lists eight clients under **Modern Metals - …**: - Base Gems + Base Minerals - All Add-ons -Each includes Modern Metals and the published OreSpawn dependency. The label +Each includes Modern Metals and OreSpawn. 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 @@ -104,7 +105,7 @@ See the ## Testing a local Base Metals candidate -Build the sibling Base Metals 1.14 checkout, then run +Build the sibling Base Metals 1.16.5 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 @@ -114,7 +115,7 @@ 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.15 checkouts first, then +For Base Gems and Base Minerals, build their sibling 1.16.5 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 diff --git a/build.gradle b/build.gradle index 14a8c2bc..a38cee57 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ def prepareProbeClasses = tasks.register('prepareProbeClasses', Sync) { into probeClasses } -tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } +tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8'; options.compilerArgs.addAll(['-Xmaxerrs', '1000']) } def compileMiningLevelChecks = tasks.register('compileMiningLevelChecks', JavaCompile) { dependsOn 'classes' @@ -88,6 +88,7 @@ def prepareRunClasses = tasks.register('prepareForgeRunModClasses', Sync) { minecraft { mappings channel: mapping_channel, version: mapping_version + if (gradle.startParameter.offline) mavenizerArguments.add('--offline') runs { configureEach { mainClass = 'net.minecraftforge.userdev.LaunchTesting' @@ -233,7 +234,7 @@ tasks.named('genEclipseRuns') { dependsOn 'configureEclipseBuildship' } tasks.named('eclipse') { dependsOn 'genEclipseRuns' } -// Compatibility profiles are generated for available 1.15 add-ons only. +// Compatibility profiles are generated for available 1.16.5 add-ons only. def baseMetalsModule = 'BaseMetals' def baseMetalsCoordinate = "zone.moddev.mc.basemetals:${baseMetalsModule}:${basemetals_version}" @@ -247,7 +248,8 @@ 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') +def dependencyMirror = providers.gradleProperty('dependencyMirror').orElse(file('.gradle/release-dependencies').isDirectory() + ? '.gradle/release-dependencies' : 'https://maven.moddev.zone/releases') repositories { minecraft.mavenizer(it) maven fg.forgeMaven @@ -303,7 +305,7 @@ tasks.register('verifyReleaseDependencies') { } } if (digest.digest().encodeHex().toString() != orespawn_sha256) { - throw new GradleException('OreSpawn 1.15.2 release checksum mismatch') + throw new GradleException('OreSpawn 1.16.5 release checksum mismatch') } } } @@ -313,7 +315,7 @@ 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 115/BaseMetals').get()).canonicalFile + File checkout = file(providers.gradleProperty('baseMetalsCheckout').orElse('../../BaseMetals 116/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 -> @@ -375,7 +377,7 @@ eclipse.synchronizationTasks 'generateCompatibilityRuns' ext.compatibilityBaseFiles = { [mapped: configurations.baseMetalsDevelopment.singleFile, version: basemetals_version.toString()] } -apply from: 'gradle/eclipse-compatibility-115.gradle' +apply from: 'gradle/eclipse-compatibility-116.gradle' tasks.register('verifyEclipseProductionClasspath') { group = 'verification' @@ -537,8 +539,6 @@ tasks.register('runPackagedProbeServer', Exec) { } } -// Uses the published OreSpawn release directly. - -apply from: 'gradle/release-115.gradle' +apply from: 'gradle/release-116.gradle' apply from: 'gradle/normalize-javadoc-trees.gradle' diff --git a/docs/PORTING_116.md b/docs/PORTING_116.md new file mode 100644 index 00000000..65747d5d --- /dev/null +++ b/docs/PORTING_116.md @@ -0,0 +1,17 @@ +# Minecraft 1.16.5 port + +The port starts from the released 1.15.2 build and targets Forge 36.2.34 on +Java 8. The ForgeGradle 7 build uses the official 1.16.5 mappings. + +- Material IDs, recipe IDs, alloy yields and OreSpawn rules carry over. Both + configuration entry points use the 1.16 client API. The Minecraft recipe + manager still shares crushing recipes with Base Metals when it is present. +- The ore overlays use the 1.16 vanilla stone sprite. Their geometry keeps the + 0.05 pixel offset and explicit UVs. Bars retain the vanilla iron-bar layout. +- Walls use the short and tall vanilla parts. The legacy chunk and item readers + convert saved wall connections from `true` and `false` to `low` and `none`. + The saved numeric registry and door migration hooks target the 1.16 engine. +- The build uses the published OreSpawn 4.1.7.116051 and Base Metals 3.1.2.116051. + +Use a copy of any existing world for an upgrade test. The Eclipse profiles +keep their saves and configurations in separate run directories. diff --git a/gradle.properties b/gradle.properties index 45a3de8d..1301c3e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +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.15.2 -forge_version=31.2.57 -mapping_channel=snapshot -mapping_version=20200514-1.15.1 -mcp_version=20200515.085601 +minecraft_version=1.16.5 +forge_version=36.2.34 +mapping_channel=official +mapping_version=1.16.5 +mcp_version=20210115.111550 mod_id=modernmetals -mod_version=3.0.0.115021 +mod_version=3.0.0.116051 mod_group=zone.moddev.mc.modernmetals -basemetals_version=3.0.3.115021 -basemetals_sha256=5c7cf937c10d1f131e2716d6242b1b56eebe051cf8f1b267aa78e6b9ad6784c1 -orespawn_sha256=5cdf25e6d98560cbef8366d6d1589b66e99a386859e5d659acbb2b806fcf8f3d +basemetals_version=3.1.2.116051 +basemetals_sha256=1816919fef35908ab42f5f4c32aa05e9df3255ae9090aa83ab14f232591da046 +orespawn_sha256=310022ccda2c6a4d118f94c72838acc8020c2f594f2e93754dc19d2644b8e9fc -orespawn_version=4.1.7.115021 +orespawn_version=4.1.7.116051 diff --git a/gradle/eclipse-compatibility-115.gradle b/gradle/eclipse-compatibility-116.gradle similarity index 95% rename from gradle/eclipse-compatibility-115.gradle rename to gradle/eclipse-compatibility-116.gradle index 9fcffee2..61bd667a 100644 --- a/gradle/eclipse-compatibility-115.gradle +++ b/gradle/eclipse-compatibility-116.gradle @@ -14,8 +14,8 @@ def enabled = pinFile.isFile() && !release ext.siblingCompatibilityEnabled = enabled Map pins = enabled ? new JsonSlurper().parse(pinFile) : [:] def definitions = [ - basegems: [name: 'BaseGems', checkout: '../../Base Gems 115/BaseGems', property: 'baseGemsCheckout'], - baseminerals: [name: 'BaseMinerals', checkout: '../../Base Minerals 115/BaseMinerals', property: 'baseMineralsCheckout'] + basegems: [name: 'BaseGems', checkout: '../../Base Gems 116/BaseGems', property: 'baseGemsCheckout'], + baseminerals: [name: 'BaseMinerals', checkout: '../../Base Minerals 116/BaseMinerals', property: 'baseMineralsCheckout'] ] def digest = { File jar -> MessageDigest.getInstance('SHA-256').digest(jar.bytes).encodeHex().toString() } def siblingJar = { File f -> @@ -37,7 +37,7 @@ ext.siblingCompatibilityProfiles = profiles tasks.register('pinLocalSiblingMods') { group = 'development' - description = 'Pins the already-built 1.15 Base Gems and Base Minerals player/mapped jars.' + description = 'Pins the already-built 1.16.5 Base Gems and Base Minerals player/mapped jars.' doLast { Map next = [:] definitions.each { id, definition -> @@ -45,7 +45,7 @@ tasks.register('pinLocalSiblingMods') { Properties properties = new Properties() new File(checkout, 'gradle.properties').withInputStream { properties.load(it) } String version = properties.getProperty('mod_version') - if (!version?.endsWith('.115021')) throw new GradleException("Not a Forge 1.15.2 candidate: ${checkout}") + if (!version?.endsWith('.116051')) throw new GradleException("Not a Forge 1.16.5 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) @@ -64,7 +64,7 @@ def verifyPins = tasks.register('verifyLocalSiblingMods') { if (!enabled) return definitions.each { id, definition -> Map pin = pins[id] - if (!pin || !pin.version?.endsWith('.115021')) throw new GradleException("Missing 1.15 ${definition.name} pin; run pinLocalSiblingMods") + if (!pin || !pin.version?.endsWith('.116051')) throw new GradleException("Missing 1.16.5 ${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}") diff --git a/gradle/ore-models.gradle b/gradle/ore-models.gradle index cd503373..72ebb60e 100644 --- a/gradle/ore-models.gradle +++ b/gradle/ore-models.gradle @@ -1,7 +1,6 @@ import groovy.json.JsonOutput -// Forge 1.12 has no GatherDataEvent. Generate the equivalent model resources -// before processResources, without launching Minecraft or writing into src. +// Generate ore models before processResources from the original overlay artwork. def assets = layout.projectDirectory.dir('src/main/resources/assets/modernmetals') def overlayFiles = fileTree(assets.dir('textures/blocks/ore_overlays')) { include '*_ore.png' } def oreStates = fileTree(assets.dir('blockstates')) { include '*_ore.json' } @@ -9,7 +8,7 @@ def generated = layout.buildDirectory.dir('generated/ore-models') def generateOreModels = tasks.register('generateOreModels') { group = 'build' - description = 'Generates the Forge 1.12 ore models from KiriCattus’s overlays.' + description = 'Generates ore models from KiriCattus’s overlays.' inputs.files(overlayFiles, oreStates).withPathSensitivity(PathSensitivity.RELATIVE) outputs.dir(generated) @@ -39,7 +38,7 @@ def generateOreModels = tasks.register('generateOreModels') { names.each { name -> writeModel(name, [ parent: 'modernmetals:block/ore_overlay', - textures: [particle: 'minecraft:blocks/stone', base: 'minecraft:blocks/stone', + textures: [particle: 'minecraft:block/stone', base: 'minecraft:block/stone', overlay: "modernmetals:blocks/ore_overlays/${name}"] ]) } 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 734744e0..aa5a2082 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.7.116051,5.0.0)"') || !metadata.contains('versionRange="[' + project.basemetals_version + ',4.0.0)"')) { throw new GradleException('Wrong or unresolved release mod metadata') } @@ -86,14 +86,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() @@ -102,7 +102,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') @@ -146,7 +146,7 @@ publishing { } pom { name = 'Modern Metals' - description = 'Modern Metals for Minecraft 1.15.2, using Forge 31 and OreSpawn 4.' + description = 'Modern Metals for Minecraft 1.16.5, using Forge 36 and OreSpawn 4.' url = 'https://github.com/MinecraftModDevelopmentMods/ModernMetals' licenses { license { @@ -175,7 +175,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) @@ -190,10 +190,10 @@ tasks.register('verify115MavenCoordinates') { } } -tasks.named('check') { dependsOn 'verify115MavenCoordinates' } +tasks.named('check') { dependsOn 'verify116MavenCoordinates' } 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') diff --git a/gradle/stage-release-dependencies.sh b/gradle/stage-release-dependencies.sh index 771b9895..c9d77a59 100644 --- a/gradle/stage-release-dependencies.sh +++ b/gradle/stage-release-dependencies.sh @@ -7,7 +7,7 @@ stage() ( local mod_id="$1" module="$2" version expected relative archive temporary version="$(value "${mod_id}_version")" expected="$(value "${mod_id}_sha256")" - [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.115021$ ]] + [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.116051$ ]] [[ "$expected" =~ ^[0-9a-f]{64}$ ]] relative="zone/moddev/mc/$mod_id/$module/$version/$module-$version.jar" archive="$mirror/$relative" diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java index 37dc4fbe..7c403b62 100644 --- a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java +++ b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/BarModelChecks.java @@ -4,7 +4,7 @@ import net.minecraft.block.*; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.model.*; -import net.minecraft.state.IProperty; +import net.minecraft.state.Property; import net.minecraft.util.Direction; import net.minecraftforge.registries.ForgeRegistries; @@ -15,14 +15,14 @@ static int run(Minecraft mc,String namespace){ for(Block block:ForgeRegistries.BLOCKS.getValues()){ if(!block.getRegistryName().getNamespace().equals(namespace)||!block.getRegistryName().getPath().endsWith("_bars"))continue; materials++; - if(!net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(block.getDefaultState(), - net.minecraft.client.renderer.RenderType.getCutoutMipped())) + if(!net.minecraft.client.renderer.RenderTypeLookup.canRenderInLayer(block.defaultBlockState(), + net.minecraft.client.renderer.RenderType.cutoutMipped())) throw new IllegalStateException("Bars are not in the cutout layer: "+block.getRegistryName()); - 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)); + for(BlockState state:block.getStateDefinition().getPossibleStates()){ + BlockState vanilla=Blocks.IRON_BARS.defaultBlockState(); + for(Property property:vanilla.getProperties()){ + Property actual=state.getBlock().getStateDefinition().getProperty(property.getName()); + if(actual!=null)vanilla=vanilla.setValue(property,state.getValue(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()); @@ -34,16 +34,16 @@ static int run(Minecraft mc,String namespace){ return checks; } private static Map geometry(Minecraft mc,BlockState state){ - IBakedModel model=mc.getBlockRendererDispatcher().getModelForState(state); + IBakedModel model=mc.getBlockRenderer().getBlockModel(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.func_187508_a().getName().getPath().equals("missingno"))throw new IllegalStateException("Missing bars sprite "+state); - int[] data=quad.getVertexData();int stride=data.length/4;List vertices=new ArrayList<>(); + if(quad.getSprite().getName().getPath().equals("missingno"))throw new IllegalStateException("Missing bars sprite "+state); + int[] data=quad.getVertices();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); + Collections.sort(vertices);String key=quad.getDirection()+vertices.toString();result.merge(key,1,Integer::sum); } return result; } diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/CutoutOcclusionChecks.java b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/CutoutOcclusionChecks.java index 601c7a03..4fbe9a2f 100644 --- a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/CutoutOcclusionChecks.java +++ b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/CutoutOcclusionChecks.java @@ -14,8 +14,8 @@ import net.minecraft.block.TrapDoorBlock; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; -import net.minecraft.fluid.IFluidState; -import net.minecraft.state.IProperty; +import net.minecraft.fluid.FluidState; +import net.minecraft.state.Property; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; @@ -29,11 +29,11 @@ final class CutoutOcclusionChecks { private static final class Neighbours implements IBlockReader { private final BlockState center; Neighbours(BlockState center) { this.center = center; } - @Override public TileEntity getTileEntity(BlockPos pos) { return null; } + @Override public TileEntity getBlockEntity(BlockPos pos) { return null; } @Override public BlockState getBlockState(BlockPos pos) { - return pos.equals(BlockPos.ZERO) ? center : Blocks.STONE.getDefaultState(); + return pos.equals(BlockPos.ZERO) ? center : Blocks.STONE.defaultBlockState(); } - @Override public IFluidState getFluidState(BlockPos pos) { return getBlockState(pos).getFluidState(); } + @Override public FluidState getFluidState(BlockPos pos) { return getBlockState(pos).getFluidState(); } } static void run() throws Exception { @@ -43,8 +43,7 @@ static void run() throws Exception { int failedBlocks = 0; for (Block block : ForgeRegistries.BLOCKS.getValues()) { String namespace = block.getRegistryName().getNamespace(); - if (!namespace.equals("modernmetals") && !namespace.equals("basemetals") - && !namespace.equals("basegems") && !namespace.equals("baseminerals")) continue; + if (!namespace.equals("basegems") && !namespace.equals("basemetals") && !namespace.equals("modernmetals")) continue; Block reference = block instanceof DoorBlock ? Blocks.IRON_DOOR : block instanceof TrapDoorBlock ? Blocks.IRON_TRAPDOOR : block instanceof PaneBlock ? Blocks.IRON_BARS : null; @@ -53,21 +52,21 @@ static void run() throws Exception { int hiddenFaces = 0; int solidStates = 0; int collisionMismatches = 0; - for (BlockState state : block.getStateContainer().getValidStates()) { + for (BlockState state : block.getStateDefinition().getPossibleStates()) { states++; - if (state.isSolid()) solidStates++; + if (state.canOcclude()) solidStates++; Neighbours reader = new Neighbours(state); for (Direction side : Direction.values()) { - BlockPos stone = BlockPos.ZERO.offset(side.getOpposite()); - if (!Block.shouldSideBeRendered(Blocks.STONE.getDefaultState(), reader, stone, side)) hiddenFaces++; + BlockPos stone = BlockPos.ZERO.relative(side.getOpposite()); + if (!Block.shouldRenderFace(Blocks.STONE.defaultBlockState(), reader, stone, side)) hiddenFaces++; } - BlockState vanilla = copyProperties(state, reference.getDefaultState()); - if (VoxelShapes.compare(state.getCollisionShape(reader, BlockPos.ZERO), + BlockState vanilla = copyProperties(state, reference.defaultBlockState()); + if (VoxelShapes.joinIsNotEmpty(state.getCollisionShape(reader, BlockPos.ZERO), vanilla.getCollisionShape(new Neighbours(vanilla), BlockPos.ZERO), IBooleanFunction.NOT_SAME)) { collisionMismatches++; } } - boolean cutout = RenderTypeLookup.canRenderInLayer(block.getDefaultState(), RenderType.getCutoutMipped()); + boolean cutout = RenderTypeLookup.canRenderInLayer(block.defaultBlockState(), RenderType.cutoutMipped()); boolean passed = cutout && solidStates == 0 && hiddenFaces == 0 && collisionMismatches == 0; Map item = new LinkedHashMap<>(); item.put("states", states); @@ -101,9 +100,9 @@ static void run() throws Exception { @SuppressWarnings({"rawtypes", "unchecked"}) private static BlockState copyProperties(BlockState from, BlockState to) { - for (IProperty property : to.getProperties()) { - IProperty source = from.getBlock().getStateContainer().getProperty(property.getName()); - if (source != null) to = to.with(property, from.get(source)); + for (Property property : to.getProperties()) { + Property source = from.getBlock().getStateDefinition().getProperty(property.getName()); + if (source != null) to = to.setValue(property, from.getValue(source)); } return to; } diff --git a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java index e9ac596f..b781d4fe 100644 --- a/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java +++ b/src/clientIntegrationTest/java/zone/moddev/mc/modernmetals/testmod/ModernMetalsClientProbe.java @@ -30,11 +30,11 @@ public final class ModernMetalsClientProbe { 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.screen.LoadingErrorScreen){ + if(ticks%200==0)System.out.println("MODERN_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,25 +42,36 @@ public final class ModernMetalsClientProbe { 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); 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; + 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.stop();return; } - mc.launchIntegratedServer("modernmetals-smoke","Modern Metals 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){ - 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.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.itemsById().size()+",\"ores\":20,\"worldReopened\":true}").getBytes(java.nio.charset.StandardCharsets.UTF_8));state=5;mc.shutdown(); + createWorld(mc);state=1;ticks=0; + }else if(state==1&&mc.level!=null&&mc.player!=null&&++loaded>80){ + 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("modernmetals-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.itemsById().size()+",\"ores\":20,\"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("modernmetals-smoke", new WorldSettings("Modern Metals 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 validate(Minecraft mc){ try { CutoutOcclusionChecks.run(); } catch (Exception e) { throw new IllegalStateException(e); } require(ModList.get().isLoaded("basemetals")==Boolean.getBoolean("modernmetalsclientprobe.expectBase"),"Expected Base Metals installation"); @@ -70,28 +81,29 @@ private static void validate(Minecraft mc){ 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 parent=mc.screen; 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