Skip to content

feat: Show modflared indicator in server list#96

Open
hattapauzi wants to merge 4 commits intoHttpRafa:forge/1.12.2from
hattapauzi:forge/1.12.2
Open

feat: Show modflared indicator in server list#96
hattapauzi wants to merge 4 commits intoHttpRafa:forge/1.12.2from
hattapauzi:forge/1.12.2

Conversation

@hattapauzi
Copy link
Copy Markdown

@hattapauzi hattapauzi commented May 5, 2026

Summary

Show the existing modflared indicator icon in the Minecraft 1.12.2 multiplayer server list for entries handled through a Cloudflare tunnel.

Context

The NeoForge 1.21.11 branch already exposes a visual server-list indicator when modflared is in use. The Forge 1.12.2 branch had the tunnel routing behavior, but the multiplayer server list did not show the same visual cue. This made it harder to tell which saved servers were being routed through modflared before connecting.

During testing, the indicator also needed to avoid overlapping Forge's compatible FML/modded-server badge, and visible status text needed to avoid unresolved translation keys in this legacy runtime.

Changes

  • Add a client mixin for ServerListEntryNormal to render the existing indicator.png asset for servers marked as using a modflared tunnel.
  • Register the new server-list entry mixin in the mixin configuration.
  • Position the modflared icon away from the Forge modded-server compatibility indicator.
  • Show direct visible text for the server-list hover tooltip and connection status feedback to avoid untranslated keys appearing in-game.
  • Keep the tooltip translation entry in the language resource for consistency with the existing resource layout.

Key Implementation Details

The server-list indicator is drawn only when the associated ServerData has a TunnelStatus with state USE. The icon is placed with a fixed offset from the right side of the server row so it does not collide with Forge's own modded-server badge.

Connection feedback now uses plain text components for the visible messages shown while joining, which avoids displaying keys such as gui.tunnel.status.use when the legacy language lookup does not resolve them in the active launcher/runtime setup.

Use Cases

  • Users can see from the multiplayer server list which saved server entries are routed through modflared.
  • Users hovering the indicator see Modflared in use instead of an untranslated language key.
  • Users connecting through a tunnel see Using Cloudflare tunnel instead of an untranslated language key.
  • Forge's compatible FML/modded-server badge remains visible and unobstructed.

Testing

Validated locally on the Forge 1.12.2 branch with Java 8:

./gradlew build

Result:

BUILD SUCCESSFUL

Manual verification performed in a PrismLauncher Forge 1.12.2 instance with MixinBootstrap installed alongside Modflared:

  1. Add or use a server entry handled by modflared.
  2. Open the multiplayer server list.
  3. Confirm the modflared indicator icon appears for the handled server.
  4. Confirm the icon does not overlap the Forge compatible FML/modded-server indicator.
  5. Hover the modflared icon and confirm the tooltip reads Modflared in use.
  6. Connect through the handled server and confirm the connection screen reads Using Cloudflare tunnel.

Links

  • Base branch: forge/1.12.2
  • Reference behavior: neoforge/1.21.11

Add a client mixin for multiplayer server-list entries so servers routed through modflared display the existing indicator icon.

Position the indicator away from the Forge modded-server compatibility badge and use direct visible strings for the hover and connection status text to avoid untranslated lang keys appearing in-game.

Register the new mixin and keep the language entry for the server-list tooltip resource.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a visual indicator in the multiplayer server list to show when a Cloudflare tunnel is active, implemented via a new mixin for ServerListEntryNormal. It also updates the TunnelStatus feedback mechanism and adds corresponding localization keys. Feedback suggests resetting the GL color state before rendering the indicator to prevent accidental tinting. Additionally, it is recommended to use I18n.format for the indicator tooltip and revert to TextComponentTranslation in TunnelStatus to ensure proper localization support instead of using hardcoded strings.

Comment thread src/main/java/dev/httxrafa/modflared/tunnel/TunnelStatus.java
hattapauzi added 2 commits May 5, 2026 13:48
Reset the render color to white before binding and drawing the modflared server-list indicator.

This prevents the indicator texture from inheriting tint from previous server-list rendering state or other modded indicators.
Restore localization lookups for the server-list tooltip and connection feedback while preserving English fallbacks when the legacy client returns unresolved translation keys.

This addresses the review feedback without reintroducing the in-game issue where raw translation keys appeared in the UI.
@hattapauzi
Copy link
Copy Markdown
Author

Update the Forge 1.12.2 artifact version from 1.12.2-legacy.1 to 1.12.2-1 now that the branch is tested and feature complete.

This changes the generated jar names to drop the legacy qualifier while preserving the mod id and build configuration.
@HttpRafa
Copy link
Copy Markdown
Owner

HttpRafa commented May 5, 2026

@HttpRafa https://github.com/copilot/share/ca5b50bc-49c4-8472-9141-1c0c405420e5

What I meant with needs some tweaks 😃

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