Skip to content

Fix VariablePredicate skipping getValue() when no value predicate is set#1619

Merged
rubensworks merged 2 commits intomaster-1.21-ltsfrom
copilot/fix-advancement-game-tests
Feb 28, 2026
Merged

Fix VariablePredicate skipping getValue() when no value predicate is set#1619
rubensworks merged 2 commits intomaster-1.21-ltsfrom
copilot/fix-advancement-game-tests

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

VariablePredicate.test() was calling variable.getValue() even when valuePredicate was absent, causing EvaluationException for operator variables with empty inputs (e.g. new int[0] in tests). Since ValuePredicate.ANY always returns true, the evaluation was purely wasteful — and fatal for structurally-valid-but-unevaluable LazyExpression instances.

Change

VariablePredicate.test() — skip getValue() when no value predicate is specified:

// Before
&& valuePredicate.orElse(ValuePredicate.ANY).test(variable.getValue())

// After
&& (this.valuePredicate.isEmpty() || this.valuePredicate.get().test(variable.getValue()))

This means getValue() is only called when there is an explicit value to compare against. Operator-type advancement predicates (which only check operator identity and input structure, not the evaluated output) now work correctly even when the variable cannot be evaluated due to missing network inputs.

Unblocks integrateddynamics:part_writer_aspect criterion checks in IntegratedTunnels for advancements like export_items_limit, filter_storage_mod, and place_logwood.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…te is specified

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix advancement-related game test failures Fix VariablePredicate skipping getValue() when no value predicate is set Feb 28, 2026
@rubensworks rubensworks marked this pull request as ready for review February 28, 2026 15:15
@rubensworks rubensworks merged commit c394db2 into master-1.21-lts Feb 28, 2026
5 checks passed
@coveralls
Copy link

Coverage Status

coverage: 45.571% (-0.1%) from 45.677%
when pulling 13c04ff on copilot/fix-advancement-game-tests
into b464674 on master-1.21-lts.

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.

3 participants