diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..192b055 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*.java] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +max_line_length = 120 +trim_trailing_whitespace = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25b6764..0738b69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,19 @@ -name: Sky's Terrain Smoother 1.10 CI +name: Sky's Terrain Smoother 1.12 CI on: push: branches: - - master-1.10.2 + - master-1.12.2 - 'feature/**' pull_request: branches: - - master-1.10.2 + - master-1.12.2 permissions: contents: read concurrency: - group: skysterrainsmoother-1.10-${{ github.workflow }}-${{ github.ref }} + group: skysterrainsmoother-1.12-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -92,13 +92,13 @@ jobs: - name: Upload audited release candidate uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: SkysTerrainSmoother-1.10.2-${{ github.sha }} + name: SkysTerrainSmoother-1.12.2-${{ github.sha }} if-no-files-found: error retention-days: 30 path: | - build/libs/SkysTerrainSmoother-0.1.0.110021.jar - build/libs/SkysTerrainSmoother-0.1.0.110021-sources.jar - build/libs/SkysTerrainSmoother-0.1.0.110021-javadoc.jar + build/libs/SkysTerrainSmoother-0.1.0.112021.jar + build/libs/SkysTerrainSmoother-0.1.0.112021-sources.jar + build/libs/SkysTerrainSmoother-0.1.0.112021-javadoc.jar build/release/SHA256SUMS CHANGELOG.md @@ -106,7 +106,7 @@ jobs: if: failure() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: SkysTerrainSmoother-1.10.2-diagnostics-${{ github.sha }} + name: SkysTerrainSmoother-1.12.2-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 4c82cb3..2212bab 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,11 +3,11 @@ name: CodeQL on: push: branches: - - master-1.10.2 + - master-1.12.2 - 'feature/**' pull_request: branches: - - master-1.10.2 + - master-1.12.2 schedule: - cron: '47 7 * * 4' diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 6009228..94f7c7f 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -19,7 +19,7 @@ jobs: set -euo pipefail version="$(sed -n 's/^mod_version=//p' gradle.properties)" test "$GITHUB_REF_NAME" = "$version" - [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.110021$ ]] + [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.112021$ ]] checks="$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/check-runs?per_page=100" --jq '[.check_runs[] | select(.name == "Build, test, and audit" and .conclusion == "success")] | length')" test "$checks" -gt 0 echo "verifyReleaseArtifacts passed in CI. This tag check publishes nothing." diff --git a/.github/workflows/validate-gradle-build.yml b/.github/workflows/validate-gradle-build.yml index 81f7cd4..8959c1a 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.10.2 + - master-1.12.2 - 'feature/**' pull_request: branches: - - master-1.10.2 + - master-1.12.2 permissions: contents: read diff --git a/CHANGELOG.md b/CHANGELOG.md index 1630b48..ace208e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.1.0.112021 + +- Added Minecraft 1.12.2 support for surface and cave smoothing. +- Kept all three levels, matching sand caps and existing-world protections. +- Retained optional Mineralogy support without adding duplicate rock pieces. + ## 0.1.0.110021 - Added hardened clay transitions and smoothing for grass oasis patches added during decoration. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..13fa9f2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Contributing + +Keep the code easy to read and straightforward to review. + +- Use four spaces, UTF-8 and LF line endings. Aim for 120 columns; do not split a registry ID or other literal just to meet the limit. +- Put each statement on its own line and use braces for conditional and loop bodies, including early returns. +- Leave a blank line between logical steps. Keep related assignments together rather than separating every line. +- Name variables for their role. Use `inventorySlot`, `cellX` or `chunkX` when that context matters, rather than a single letter or a type abbreviation. Keep established names such as `world` and `state` when their meaning is already clear. +- Declare separate local values on separate lines. Explain packed masks and coordinate conventions where the names cannot tell the whole story. +- Write comments in plain English. Explain a decision, save-format constraint or surprising API behaviour instead of repeating what the next line says. +- Document public extension points, including when they can be called and what they preserve. Keep comments current when behaviour changes. + +For Eclipse, import [the Java formatter profile](style/eclipse-java-formatter.xml) under **Java > Code Style > Formatter** and select **Sky Java**. The formatter handles layout; braces and logical grouping still need a quick human review. + +Treat registry IDs, metadata palettes, configuration keys and saved NBT fields as compatibility contracts. A readability change should not alter them. Keep behavioural changes separate and run the relevant tests before submitting a pull request. See [the build guide](docs/BUILDING.md) for this branch's toolchain and checks. diff --git a/README.md b/README.md index 556cd76..03a42d9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Sky's Terrain Smoother softens new Overworld slopes using pieces from Sky's Grass Slabs and Sky's Building Pieces. It also provides ordinary and red sand slabs for beaches and desert slopes. -This beta is for Minecraft 1.10.2 and Forge 12.18.3.2511. Install Terrain -Smoother 0.1.0.110021, Grass Slabs 1.1.0.110021 and Building Pieces -0.3.0.110021 together on the client and server. Mineralogy is optional. +This beta is for Minecraft 1.12.2 and Forge 14.23.5.2859. Install Terrain +Smoother 0.1.0.112021, Grass Slabs 1.1.0.112021 and Building Pieces +0.3.6.112021 together on the client and server. Mineralogy is optional. ## Smoothing levels diff --git a/build.gradle b/build.gradle index 7641b77..83c6da1 100644 --- a/build.gradle +++ b/build.gradle @@ -59,18 +59,27 @@ tasks.withType(JavaCompile).configureEach { } } -def grassSlabsDirectory = file(providers.gradleProperty('grassSlabsDirectory').getOrElse('../..' + '/SkysGrassSlabs110/SkysGrassSlabs')) -def buildingPiecesDirectory = file(providers.gradleProperty('buildingPiecesDirectory').getOrElse('../..' + '/SkysBuildingPieces110/SkysBuildingPieces')) -def grassSlabsDevelopmentJar = new File(grassSlabsDirectory, 'build/libs-dev/SkysGrassSlabs-1.1.0.110021-deobf.jar') -def buildingPiecesDevelopmentJar = new File(buildingPiecesDirectory, 'build/libs-dev/SkysBuildingPieces-0.3.0.110021-deobf.jar') +def grassSlabsDirectory = file(providers.gradleProperty('grassSlabsDirectory').getOrElse('../..' + '/SkysGrassSlabs112/SkysGrassSlabs')) +def buildingPiecesDirectory = file(providers.gradleProperty('buildingPiecesDirectory').getOrElse('../..' + '/SkysBuildingPieces112/SkysBuildingPieces')) +def grassSlabsDevelopmentJar = new File(grassSlabsDirectory, 'build/libs-dev/SkysGrassSlabs-1.1.0.112021-deobf.jar') def contentLock=new Properties() file('gradle/content-dependencies.properties').withInputStream { contentLock.load(it) } + +def localPiecesVersion = providers.gradleProperty('buildingPiecesCoreVersion') +if (localPiecesVersion.isPresent() && + (System.getenv('CI') != null || !providers.gradleProperty('buildingPiecesDirectory').isPresent())) { + throw new GradleException('A local core-version override needs an explicit core directory and is not allowed in CI.') +} +def piecesVersion = localPiecesVersion.getOrElse(contentLock.getProperty('pieces.version')) +def buildingPiecesDevelopmentJar = new File(buildingPiecesDirectory, + "build/libs-dev/SkysBuildingPieces-${piecesVersion}-deobf.jar") def verifyContentDependencies=tasks.register('verifyContentDependencies') { doLast { [grass:grassSlabsDirectory,pieces:buildingPiecesDirectory].each { name,directory -> Properties metadata=new Properties() new File(directory,'gradle.properties').withInputStream { metadata.load(it) } - if(metadata.mod_version!=contentLock.getProperty(name+'.version')) + String expectedVersion = name == 'pieces' ? piecesVersion : contentLock.getProperty(name + '.version') + if(metadata.mod_version!=expectedVersion) throw new GradleException('Content dependency version does not match its lock: '+name) if(System.getenv('CI')!=null) { Process git=new ProcessBuilder('git','-C',directory.path,'rev-parse','HEAD').start() @@ -146,14 +155,14 @@ minecraft { } } -// Forge 1.10 discovers a development mod from one classes/resources root. -def forge10DevelopmentOutput = layout.buildDirectory.dir('forge10-development/main') +// Forge 1.12 discovers a development mod from one classes/resources root. +def forge12DevelopmentOutput = layout.buildDirectory.dir('forge12-development/main') def syncForge10DevelopmentResources = tasks.register('syncForge10DevelopmentResources', Sync) { group = 'ide' dependsOn tasks.named('classes') from tasks.named('compileJava', JavaCompile).flatMap { it.destinationDirectory } from sourceSets.main.output.resourcesDir - into forge10DevelopmentOutput + into forge12DevelopmentOutput } tasks.configureEach { if (name in ['runClient', 'runServer', 'runTestClient', 'runTestServer']) { @@ -164,7 +173,7 @@ tasks.configureEach { tasks.named('compileJava', JavaCompile).get().destinationDirectory.get().asFile, sourceSets.main.output.resourcesDir ] as Set - classpath = files(forge10DevelopmentOutput, classpath.filter { + classpath = files(forge12DevelopmentOutput, classpath.filter { !splitMainOutputs.contains(it) }) } @@ -205,7 +214,7 @@ def configureFromForgeRun = { JavaExec process, String runTaskName -> tasks.named('compileJava', JavaCompile).get().destinationDirectory.get().asFile, sourceSets.main.output.resourcesDir ] as Set - run.setClasspath(files(forge10DevelopmentOutput, run.classpath.filter { + run.setClasspath(files(forge12DevelopmentOutput, run.classpath.filter { !splitMainOutputs.contains(it) })) if (pinnedJava8.isPresent()) run.executable = javaToolchains.launcherFor(exactJava8Spec).get().executablePath.asFile.path @@ -461,12 +470,12 @@ def releaseFiles = provider { tasks.register('verifyReleaseMetadata') { group = 'verification' doLast { - if (project.minecraft_version != '1.10.2' || project.forge_version != '12.18.3.2511' || - project.mapping_channel != 'stable' || project.mapping_version != '29-1.10.2' || + if (project.minecraft_version != '1.12.2' || project.forge_version != '14.23.5.2859' || + project.mapping_channel != 'stable' || project.mapping_version != '39-1.12' || project.loader_name != 'forge' || project.loader_code != '1' || project.java_version != '8' || project.java_toolchain_version != '8.0.502+7' || project.mod_id != 'skysterrainsmoother') { - throw new GradleException('Unexpected 1.10.2 release metadata') + throw new GradleException('Unexpected 1.12.2 release metadata') } } } diff --git a/docs/BUILDING.md b/docs/BUILDING.md index efbd47b..1fab42f 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -1,23 +1,28 @@ # Building from source -Use Java 17 for Gradle and Temurin 8.0.502+7 for production. Set `STS_JAVA8_HOME` -to the Java 8 installation. The wrapper uses Gradle 9.6.1 and ForgeGradle -7.0.34 with stable 29-1.10.2 mappings. +Use the Gradle 9.6.1 wrapper with Java 17 and Temurin 8.0.502+7 for production. +Set `STS_JAVA8_HOME` to the Java 8 installation. This branch targets +Minecraft 1.12.2 with ForgeGradle 7.0.34. -Build the Grass Slabs and Building Pieces source commits recorded in +Build the exact Grass Slabs and Building Pieces source commits listed in `gradle/content-dependencies.properties` with their `jar` tasks first. -Then run `gradlew check build javadoc verifyReleaseArtifacts -writeReleaseChecksums verifyEclipseProductionClasspath` here. -The default layout uses sibling Grass Slabs and Building Pieces 1.10 -checkouts. Elsewhere, pass `-PgrassSlabsDirectory=` and -`-PbuildingPiecesDirectory=`. Development dependencies use their -deobfuscated jars; packaged games use the normal main jars. No dependency -classes or assets are bundled. +The default layout uses sibling checkouts. For another layout, pass +`-PgrassSlabsDirectory=` and +`-PbuildingPiecesDirectory=`. +Then run: -The build-only integration mod exercises real Forge startup, grass lifecycle, -every footprint, player-tracked chunk generation and a saved-world reload. -It is absent from production artifacts and ordinary Eclipse runs. Use -`genEclipseRuns eclipse` to regenerate those runs. CI builds the pinned content -mods first. Publication remains disabled until this mod has its own CurseForge -project. +```text +gradlew check build javadoc verifyReleaseArtifacts writeReleaseChecksums verifyEclipseProductionClasspath +``` + +Development dependencies use deobfuscated jars. Packaged games use the normal +main jars; dependency classes and assets are not bundled. CI builds the exact +pinned commits rather than moving branches. + +A local-only `buildingPiecesCoreVersion` override can test another core +candidate. It requires an explicit core directory and is rejected in CI. + +Use `genEclipseRuns eclipse` to prepare the Java 8 IDE setup. Ordinary launches +exclude unit tests and build-only runtime probes. Publication remains disabled +until this mod has its own CurseForge project. diff --git a/gradle.properties b/gradle.properties index 27b80ba..4dfd629 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,11 +4,11 @@ org.gradle.configuration-cache=false org.gradle.caching=true org.gradle.parallel=false net.minecraftforge.gradle.merge-source-sets=false -minecraft_version=1.10.2 -minecraft_version_range=[1.10.2] -forge_version=12.18.3.2511 +minecraft_version=1.12.2 +minecraft_version_range=[1.12.2] +forge_version=14.23.5.2859 mapping_channel=stable -mapping_version=29-1.10.2 +mapping_version=39-1.12 loader_name=forge loader_code=1 java_version=8 @@ -20,7 +20,7 @@ release_enabled=false curseforge_project_id= mod_name=Sky's Terrain Smoother mod_license=LGPL-2.1-only -mod_version=0.1.0.110021 +mod_version=0.1.0.112021 mod_group=zone.moddev.mc.skysterrainsmoother mod_authors=SkyBlade1978 mod_description=Smooths new Overworld surfaces with existing slabs, steps and corners. Optional Mineralogy support. diff --git a/gradle/content-dependencies.properties b/gradle/content-dependencies.properties index 73c6780..2eeb07d 100644 --- a/gradle/content-dependencies.properties +++ b/gradle/content-dependencies.properties @@ -1,6 +1,6 @@ grass.repository=SkyBlade1978/SkysGrassSlabs -grass.commit=95c11e25bd8dad7398e05104277aa6cb522719bc -grass.version=1.1.0.110021 +grass.commit=1b6069b5922d20285432bb3a76dbcfccd1b1d2d8 +grass.version=1.1.0.112021 pieces.repository=SkyBlade1978/SkysBuildingPieces -pieces.commit=f21616d4e4bfe09dcf25490a3568fd846a820792 -pieces.version=0.3.0.110021 +pieces.commit=78360eefcf6f7637c7959f34dc45bdb9efb6ba12 +pieces.version=0.3.6.112021 diff --git a/src/integrationTest/java/zone/moddev/mc/skysterrainsmoother/probe/CaveProbe.java b/src/integrationTest/java/zone/moddev/mc/skysterrainsmoother/probe/CaveProbe.java index f0ca517..86bf1cf 100644 --- a/src/integrationTest/java/zone/moddev/mc/skysterrainsmoother/probe/CaveProbe.java +++ b/src/integrationTest/java/zone/moddev/mc/skysterrainsmoother/probe/CaveProbe.java @@ -21,167 +21,330 @@ /** Real cave-floor regressions, never included in production launches or jars. */ final class CaveProbe { - private static final int[] DX={0,1,0,-1},DZ={-1,0,1,0},CX={-1,1,1,-1},CZ={-1,-1,1,1}; - private CaveProbe() { } + private static final int[] DX = { 0, 1, 0, -1 }, DZ = { -1, 0, 1, 0 }, CX = { -1, 1, 1, -1 }, CZ = { -1, -1, 1, 1 }; + + private CaveProbe() { + } + static int run(WorldServer world) { - BlockPos floor=new BlockPos(3000,70,3000); - Chunk owner=world.getChunkFromBlockCoords(floor); - clear(world,floor,69,255); - fixture(world,floor,6); - world.setBlockState(floor.north().up(),Blocks.STONE.getDefaultState(),2); - SkysTerrainSmoother.engine.smooth(world,owner,1); - RuntimeProbe.require(!world.isAirBlock(floor.up()),"cave floor below a roof receives a matching slab"); - int checks=1; - TerrainMaterial stone=MaterialCatalogue.instance().source(Blocks.STONE.getDefaultState()); - for(int level=1;level<=3;level++)for(int cardinal=0;cardinal<16;cardinal++)for(int diagonal=0;diagonal<16;diagonal++) { - fixture(world,floor,6); - for(int d=0;d<4;d++) { - if((cardinal&(1<