Skip to content

Add negative game tests for all advancements#195

Merged
rubensworks merged 2 commits intomaster-1.21-ltsfrom
copilot/add-negative-game-tests-advancements
Feb 28, 2026
Merged

Add negative game tests for all advancements#195
rubensworks merged 2 commits intomaster-1.21-ltsfrom
copilot/add-negative-game-tests-advancements

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Adds negative game tests for all advancements to guard against false-positive triggers, mirroring the pattern from CyclopsMC/IntegratedDynamics#1620.

Changes

  • assertAdvancementNotDone — new helper symmetric with assertAdvancementDone; asserts an advancement was not obtained
  • root negative — triggers inventory_changed with DIRT instead of minecraft:chest
  • uncolossal negative — places a vanilla CHEST instead of uncolossal_chest
  • base/* negatives (×7) — forms a chest with the wrong material (e.g. form COPPER, assert base/wood not done)
  • size/* negatives (×7) — forms a chest of the correct material but size 2 (below the required ≥10 threshold)
// Example: size advancement should NOT fire for a small chest
@GameTest(template = TEMPLATE_EMPTY)
public void testAdvancementSizeWoodNegative(GameTestHelper helper) {
    testAdvancementSizeNegative(helper, ChestMaterial.WOOD, "colossalchests:size/wood");
}

private void testAdvancementSizeNegative(GameTestHelper helper, ChestMaterial material, String advancementId) {
    BlockPos excludedWall = POS.offset(1, 0, 0);
    createChest(helper, POS, material, 2, Sets.newHashSet(excludedWall)); // size 2, not ≥10
    ServerPlayer serverPlayer = makeMockServerPlayer(helper);
    placeBlockAsServerPlayer(helper, serverPlayer, excludedWall, material.getBlockWall());

    helper.succeedWhen(() -> assertAdvancementNotDone(helper, serverPlayer, ResourceLocation.parse(advancementId)));
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • maven.fabricmc.net
    • Triggering command: /opt/hostedtoolcache/Java_Microsoft_jdk/21.0.2/x64/bin/java /opt/hostedtoolcache/Java_Microsoft_jdk/21.0.2/x64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx3G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.8-bin/dl7vupf4psengwqhwktix4v1/gradle-8.8/lib/gradle-launcher-8.8.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.8-bin/dl7vupf4psengwqhwktix4v1/gradle-8.8/lib/agents/gradle-instrumentation-agent-8.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.8 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title [WIP] Add negative game tests for all advancements in the mod Add negative game tests for all advancements Feb 28, 2026
@rubensworks rubensworks marked this pull request as ready for review February 28, 2026 17:56
@rubensworks rubensworks merged commit 22ec641 into master-1.21-lts Feb 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants