Repository navigation
Add tests to avoid regressions and fix some bugs - #1195
Merged
Merged
Conversation
The check task of each loader now depends on its game test run, so 'gradlew build' (used by the CI) fails when a game test fails.
Adds daemon JVM criteria (generated with 'gradlew updateDaemonJvm --jvm-version=25'). The build plugins require Java 25, so environments launching Gradle with an older JVM, like GitHub's automatic dependency submission (Java 21), failed while configuring the project.
This reverts commit 975a78a.
The build workflow now also runs on pull requests, where it runs the game tests through the shared Minecraft build workflow.
Pull requests run the build and the game tests. Pushes only trigger a build on the minecraft/** branches, other branches being built through their pull request.
Rakambda
added a commit
to RakambdaOrg/OverpoweredMending
that referenced
this pull request
Oct 10, 2026
## What Adds in-game GameTests covering the mod's behaviour on **Fabric, Forge and NeoForge**, so regressions are caught when making changes or porting to a new Minecraft version. Same setup as RakambdaOrg/FallingTree#1195. - `gametest/src/main/java`: loader independent scenarios (19 tests), each a `@GameTestCase` static method: - **Repair**: items in main inventory / hotbar / armor / offhand are repaired, leftover xp goes to the player, xp spreads over several items, odd damage rounding. - **Ignored items**: no mending, undamaged, unbreakable, empty inventory. - **Selection mode**: `PERCENTAGE` vs `ABSOLUTE`. - **Orbs**: merged orbs consumed one at a time (#559), pickup delay set and respected. - **Config sync**: dedicated server config overrides local, integrated server ignored, packet round trip. - `gametest/gametest.gradle`: generates the `test_instance` data from the annotations. - Each loader has a `gametest` source set with a tiny `overpoweredmending_gametest` mod registering the test functions. - Root `gameTest` task runs all loaders: `./gradlew gameTest --continue`. - CI: build on `minecraft/**` pushes and PRs; game tests run on PRs and upload reports/logs. - `gradle/gradle-daemon-jvm.properties`: Gradle daemon always runs on Java 25, fixing the *Automatic Dependency Submission* job that launches Gradle with Java 21. ## Bugs found and fixed - **Forge**: the mod failed to load: `@OnlyIn` on `PlayerLeaveListener.onPlayerLoggedOutEvent` is rejected by Forge 66. Removed (same fix as FallingTree). - **Fabric**: `ExperienceOrbMixin` injected at `HEAD` of `playerTouch`, before vanilla's `takeXpDelay == 0` and `ServerPlayer` checks. Orbs were absorbed every tick, ignoring the pickup delay, and the logic could run client side. Added the same guards. NeoForge/Forge events already fire after these checks. ## Reviewer notes - Fabric fix changes gameplay: mending now follows the vanilla pickup rate (slower than before on Fabric). - Tests are synchronous (mock player + orb touched directly, going through each loader's real hook), so they share one test environment instead of one per test like FallingTree. - Verified locally: all 3 loaders report `All 20 required tests passed` (19 + vanilla `always_pass`). Mutating the repair ratio made 9 tests fail on NeoForge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.