Repository navigation
Upmerge expressions in the Logic Programmer to 26.1 - #1781
Merged
Merged
Conversation
This allows constant values and multiple nested operators to be combined within a single variable card, without having to combine multiple variable cards. These expressions can either be created through the existing Logic Programmer interface, or they can be written in a text-form for easy exchange across worlds and players.
Ports the expressions of the Logic Programmer (#1766) to Minecraft 26.1: - Client-only classes of the expression panel move to core.logicprogrammer.client, the typed text is kept by the screen instead of the container, and the card facades get client classes for their model overlays. - Expression trees are written with ValueOutput and ValueInput, so values and operators in them are serialized as everywhere else in 26.1. - Values written with their type in the text leave out the "v" field of the serialized value, and items are written as their stack, so the text form is the same as in 1.21, such as @item{id: "minecraft:diamond"}. - Rendering uses GuiGraphicsExtractor, with strata instead of depth for the popups and dragged parameters, and input uses the new event types. - Tests use JUnit 5 and the game test API of 26.1. Unknown items, invalid entity ids and non-compound lists can no longer be read at all, so their error is bad_value instead of value_changed, and an empty entity is written as @entity{}. - The icons of the expression advancements are converted to the 26.1 format, and an unreadable operator makes an expression card invalid instead of throwing, which crashed the book on the Expressions tutorial. - The expression action packet no longer uses @onlyin, which NeoForge 26.1 warns about on every start. Also fixes the invisible operator symbol in the Logic Programmer, which was drawn with color 0, fully transparent since 26.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y
rubensworks
force-pushed
the
feature/expression-cards-26
branch
from
November 8, 2026 18:11
69ea9cb to
d48baaa
Compare
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.
Merges
master-1.21-ltsintomaster-26-lts. This brings the Logic Programmer expressions of #1766 to Minecraft 26.1. It is a single merge commit.Fixes beyond the port
The merge commit also contains three fixes I found while testing the port in a 26.1 client:
RenderPatterndrew the symbol with color0, which 26.1 treats as fully transparent. Now it usesARGB.opaque(0). It hid the symbol of every operator, so the expression panel was hard to test without it.@OnlyInon the expression action packet. NeoForge 26.1 shows a loading warning screen on every start for mods that use it. No other packet on 26.1 uses it, so it is removed.Port decisions
core.logicprogrammer.client:ExpressionTextField,ExpressionTextController,ExpressionStartPanel,ExpressionValueEditor,ExpressionParameterChips,ParameterChipLayout,ExpressionBreadcrumb,ExpressionPanelButtons,ExpressionPanelRenderingandButtonIcon.OperatorLPElementreaches them through itsOperatorLPElementClient.ScreenCallbackHandler, which gainsonExpressionNavigated()andresetExpressionText().ExpressionVariableFacadeClientandReferencePlaceholderVariableFacadeClientfor their card model overlays.ValueOutputandValueInput, so the operators and values inside them are stored the same way as everywhere else on 26.1 (underv). The card NBT therefore differs from 1.21.operatorNametooperator), and neither kind of card is converted. A 1.21 expression card in an upgraded world reads as an invalid card, and with the book crash fix it no longer crashes anything.ExpressionValueTagsmaps serialized values to the tags written in expression text and back.vwrapper.ExtendedCountfor counts above 99.@Item{id: "minecraft:diamond"},@Fluid{amount: 1000, id: "water"}.GuiGraphicsExtractor, with colors that carry alpha.nextStratum()instead of z offsets.setTooltipForNextFrame.MouseButtonEvent,KeyEvent,CharacterEventandContainerInput.imageWidth, which is final in vanilla. CyclopsCore's access transformer has the samepublic-fline, but it only applies at runtime. This mod's ownaccesstransformer.cfgneeds it to compile.expressionMaxLengthuses@ConfigurablePropertyCommonwithModConfigLocation.SERVER, like the other 26.1 properties."set"with theOptionalthatgetStringnow returns, so setting typed text silently did nothing. It now usesgetStringOr.Book crash
Opening pages 7 and 8 of the Expressions tutorial crashed the client. There were two causes:
"op": "integrateddynamics:arithmetic_addition","v": 3).NoSuchElementExceptionthat nothing caught, so drawing the icon crashed the render thread.The fix:
Two tests cover it:
TestExpressionTrees.testSerializationOperatorWithoutName(unit test).GameTestsAdvancements.testAdvancementExpressionIcons, which checks that the three icons are valid expression cards. I ran it against the old icons, and it fails on its assertion.Test changes
bad_valueinstead ofvalue_changed, and an empty entity prints as@Entity{}.ValueTypeAddonMockedwrites its value underv, like real value types on 26.1.Testing
./gradlew build: all 1057 unit tests pass../gradlew runGameTestServer: all 1096 game tests pass, including the expression integration tests.+ Parameterin the start panel givesx =>, and typingx + 1opens Arithmetic Addition with anxchip.@Itemkeeps its count:Diamond (5).@Fluid{amount:1000,id:"minecraft:water"}.@Fluid{amount: 250, id: "lava"}shows asLava (250 mB).apply(#double, 3).2 * 5 + 4.[20]for a classic Filter card that takes an expression operator.Found, not fixed here
AdvancementButtonputs the description on one line. Existing advancements are affected too, such assmart_pressure_platewith 238 characters (ours is 135), so this PR doesn't cause it. It would need a fix in CyclopsCore.🤖 Generated with Claude Code
https://claude.ai/code/session_01MHtucHo4Qy2pTfBMgeE54y