Skip to content

Add tests to avoid regressions and fix some bugs - #1195

Merged
Rakambda merged 15 commits into
minecraft/26.3from
feat/tests
Oct 10, 2026
Merged

Rakambda merged 15 commits into
minecraft/26.3from
feat/tests

Conversation

@Rakambda

@Rakambda Rakambda commented Oct 9, 2026

Copy link
Copy Markdown
Member

No description provided.

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.
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
Rakambda merged commit 1fb30fc into minecraft/26.3 Oct 10, 2026
3 checks passed
@Rakambda
Rakambda deleted the feat/tests branch October 10, 2026 17:09
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant