Add boolean logical operators (&&, ||, !) to NBT path expressions#216
Closed
Copilot wants to merge 5 commits intomaster-1.21-ltsfrom
Closed
Add boolean logical operators (&&, ||, !) to NBT path expressions#216Copilot wants to merge 5 commits intomaster-1.21-ltsfrom
Copilot wants to merge 5 commits intomaster-1.21-ltsfrom
Conversation
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
… expressions Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add basic logical operator support to NBT expression parsing
Add boolean logical operators (&&, ||, !) to NBT path expressions
Feb 12, 2026
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.
NBT path expressions previously lacked boolean operators for combining conditions in filters and comparisons.
Changes
New parse handlers following the relational operator pattern:
NbtPathExpressionParseHandlerBooleanLogicalAnd-&&operatorNbtPathExpressionParseHandlerBooleanLogicalOr-||operatorNbtPathExpressionParseHandlerBooleanLogicalNot-!prefix operatorKey implementation detail: Operators use parent execution context to evaluate right-hand expressions against original tag values, not the boolean result from the left side. This enables chained comparisons like
@.value > 5 && < 10.Shared utility: Extracted
NbtPathExpressionHelpers.isTruthy()for consistent truthiness evaluation (ByteTag(1) = true, ByteTag(0) = false, other non-null tags = true).Usage
Test coverage includes unit tests for each operator and integration tests with filter expressions.
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/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/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)www.puppycrawl.com/opt/hostedtoolcache/CodeQL/2.24.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/CyclopsCore/.codeql-scratch/dbs/java/working/files-to-index12823067718343908668.list --sourceArchiveDir=/home/REDACTED/work/CyclopsCore/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/CyclopsCore/.codeql-scratch/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.