Repository navigation
feat: per-server rules with a hub-based settings UI - #30
NebulaTechs wants to merge 6 commits into
Conversation
The settings UI is rebuilt on Cloth Config (sub-categories, per-field validation, save/cancel), so it is now a compile-time and runtime dependency rather than an optional one. The CC release line is not semver-safe across MC lines, so the version is pinned per MC version instead of being resolved from a range. Each versions/<v>/gradle.properties carries its own cloth_config_version: 11.1.136 for 1.20.1 through 26.3.159 for 26.3 on Fabric, and 15.0.140 / 21.11.160 / 26.2.155 on the three NeoForge trees. A range would be actively wrong here: 21.11.160 declares ">=1.21.9-", which numerically admits 26.x, but its jar still ships the old render(GuiGraphics,...) path and references net.minecraft.resources.Identifier -- a class that does not exist on 1.21.9/1.21.10. Resolving it by range puts that jar on 1.21.9 and crashes the game with NoClassDefFoundError. The runtime depends entry therefore pins the exact version too. The dependency is declared as required in fabric.mod.json and in each neoforge.mods.toml, so a missing Cloth Config is reported at launch instead of failing later with a class-not-found.
The settings screen was one long tabbed page that mixed every option into a single flat list, so the options that only make sense for one server and the ones that are purely local were impossible to tell apart and impossible to scope. It is replaced by a hub with three destinations: per-server rules, the account manager and the client-local settings. The configuration model changes with it. The server profiles map is now an ordered list of rules, each carrying its own settings, and a single ANY rule always exists as the fallback for servers no other rule matches. The ANY rule holds the global baseline, is always enabled, always applied last and cannot be deleted, so the effective settings of a server are "the first matching rule, otherwise the ANY rule" rather than "the profile for this address, otherwise whatever was left over". The config file carries a version field. A file without one is a v1 file and is migrated on load: the global settings move into the ANY rule and the server profiles become EXACT rules. A file with a higher version is refused outright - loading it would silently drop the fields it contains, and writing back would destroy them, so the file is left untouched and the UI says so. A v2 file also writes the global settings to the old top-level key as a redundant copy. An older build reading that file then still finds the global defaults where it expects them instead of coming up empty. Rules are matched by the address the player typed, not only by the resolved IP, so a rule can target "play.example.com" without caring which address it points at today. The typed address is captured before the connection is resolved and claimed again once the server sends its login packet. The client information normalizer claims en_us in the outgoing handshake, so everything a server can read back has to be en_us too. Server pack translations are now kept per locale, and a keybind rendered in the player's real locale is replaced with the en_us default. The settings button on the multiplayer screen list is back, now opening the hub, and can be turned off in the settings screen. It stays on by default because without Mod Menu it is the only way into the settings in-game.
AntiExploitPreventer's TranslationChecker works by planting a sign on the player's own feet block, opening the sign editor at that position and reading back whatever text the client sends. A vanilla client never has a sign on the block it stands in, so the sign appearing there can only have been made up by the server. The sign editor is left alone when this happens. Cancelling it would make the client behave in a way no vanilla client can - a vanilla client always sends the sign update when the editor closes - and the checker waits for that reply without a timeout, so a client that stays quiet pins one server-side thread per probed key. The text the probe is after is already reduced to the raw translation key by the translation protection, so the only thing missing was telling the user it happened. The alert goes through a per-category burst limit. AEP plants one sign per known mod translation key, which is enough of a burst to flood the chat with alerts and make the client itself the most noticeable thing in the log. Alerts inside the window are dropped from the chat and toast pipeline, while every event is still recorded.
The local agent run directories are not part of the project and should not show up as untracked files.
…ngs UI The hub-based settings screen replaced the hand-rolled tabbed one, and two controls that existed before it were dropped in the swap: "Clear Cached Resource Packs" and "Trust This Server (Skip Auto-Purge)". Their language keys were still in the locale files, so nothing warned that the features had become unreachable - the strings were there, the UI entry points were not. Both are global rather than per-server. The clear button acts on the pack cache as a whole, and the trust toggle exempts the bucket of the server that is connected right now, which is a single address rather than something a rule could own: the exemption set is keyed by server address and is independent of how rules match. The toggle is only added while a server is connected, because there is no current server to exempt otherwise. The clear button has to be injected into the Cloth Config list, which has no button entry type, so it takes the row that was reserved below the list. Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
The README still described the old flat tabbed settings screen and said NeoForge needed no dependency beyond itself. Both stopped being true when the settings screen moved to Cloth Config and the tabs became a hub, so the install instructions would have left people without the mod they need for the settings screen to open at all. The layout tables are rewritten around what the screens actually are now - the hub, the per-rule options, and the client-wide settings - and the per-server rules feature gets a section of its own, since the matching rules are the part a reader cannot guess from the option names alone. Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
|
Important Review skippedToo many files! This PR contains 203 files, which is 103 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. CodeRabbit couldn't verify your organization's usage billing state, so no usage-priced review was started. Retry after the billing service recovers.
|
SU4G3
left a comment
There was a problem hiding this comment.
The per-server rules feature makes sense, but I would hold this PR until the rule is applied before connection setup and the target binding is made reliable.
-
The active rule is selected at the tail of
ClientPacketListener.handleLogin(ClientPacketListenerMixin.java:108-126).GameConnectionProxyMixinreadsconfig.getSettings()whileConnection.connectis opening the socket (GameConnectionProxyMixin.java:63-97). A proxy configured only in a server rule therefore cannot route that server's initial connection: the global/ANY setting is used instead, potentially connecting directly. Other settings used during the handshake may also see the wrong rule. Please select the target rule before these consumers run and verify the connection path in a running client. -
ServerTargets.claim()falls back toPENDING.peekLast()when the dialed IP does not match (ServerTargets.java:77-96). This queue also receives status-ping resolutions. With concurrent or stale captures, a connection can inherit another server's typed host and use its settings. Please bind the capture to the specific connection without guessing from a shared last-in queue; if the target is unknown, fall back to ANY safely. Test concurrent pings/connections and proxy or redirect cases. -
SeasonalWallpaperMixinremoved theSeason.NONEreturn.NONEnow draws the tree texture on OpSec screens because the icon expression selects TREE for every non-HALLOWEEN value (SeasonalWallpaperMixin.java:70-85). Please restore the guard.
The build results in the PR are useful, but the description says the changed behavior was not exercised in a launched client. Please run the relevant connection and UI scenarios before merging.
What does this change
Replaces the single flat tabbed settings screen with a hub-based layout, and moves
every protection option from a global setting to a per-server rule.
The hub. The settings screen was one long tabbed page that mixed every option
into a single flat list, so the options that only make sense for one server and the
ones that are purely client-local were impossible to tell apart and impossible to
scope. It is replaced by a hub with three destinations: per-server rules, the
account manager, and the client-wide settings.
Per-server rules. The server profiles map becomes an ordered list of rules, each
carrying its own copy of the settings, plus a mandatory
ANYrule that alwaysexists as the fallback for servers no other rule matches. The ANY rule holds the
global baseline, is always enabled, always applied last, and cannot be deleted, so
the effective settings of a server are "the first matching rule, otherwise the ANY
rule" rather than "the profile for this address, otherwise whatever was left over".
Rules match by the address the player typed, not only by the resolved IP, so a rule
can target
play.example.comwithout caring which address it points at today. Arule matches by
EXACTaddress,REGEX, or resolvedIP, and its Applies Tofield takes a comma-separated list so one rule can cover a whole set of servers.
Config migration. The config file carries a version field. A file without one is
a v1 file and is migrated on load: the global settings move into the ANY rule and
the server profiles become EXACT rules. A file with a higher version is refused
outright - loading it would silently drop the fields it contains, and writing back
would destroy them, so the file is left untouched and the UI says so. A v2 file also
writes the global settings to the old top-level key as a redundant copy, so an
older build reading that file still finds the global defaults where it expects them.
Other changes in this PR:
is built with it, so the mod will not start without it.
TranslationCheckerplants asign on the player's own feet block, opens the sign editor at that position and
reads back whatever text the client sends. A vanilla client never has a sign on the
block it stands in, so the sign appearing there can only have been made up by the
server. The sign editor is left alone when this happens - cancelling it would make
the client behave in a way no vanilla client can - but the user is now told it
happened.
are restored in the new one. They were unreachable after the hub layout replaced
the hand-rolled screen, while their language keys stayed in the locale files.
Build trees touched
src/, Stonecutter — ran./gradlew buildAllor targeted:<version>:compileClientJava)neoforge/(1.21.1)neoforge-1.21.11/neoforge-26.2/Testing
runClient) and exercised the changed behaviorBuilds run:
./gradlew buildAll./gradlew buildneoforge/./gradlew buildneoforge-1.21.11/./gradlew buildneoforge-26.2/buildAllcovers every Fabric version the project targets (1.20.1, 1.20.2, 1.20.4,1.20.6, 1.21.1, 1.21.4, 1.21.6, 1.21.9, 1.21.11, 26.1, 26.2, 26.3), and the shared
source set is compiled against each of them separately, since the Stonecutter
//?blocks mean a version that is not selected is not compiled at all. The threeNeoForge trees are independent Gradle projects and are each built on their own.
The two files touched by the last commit (
SettingsScreen.java) carry noStonecutter conditionals, so the same source is compiled on every target.
The only warnings are pre-existing mixin-mapping warnings in files this PR does not
touch (
GameConnectionProxyMixin,PacketProcessorMixin,DownloadQueueMixin,ComponentSerializationMixin) and a deprecation notice inCloudflarePingRelay.Not done: the client was not launched to exercise the changed behavior at runtime.
The new settings UI, the rule matching and the AEP detection are therefore
compile-verified only.
Checklist