Skip to content

Jade Compatibility

MateoF24 edited this page May 8, 2026 · 3 revisions

Jade Compatibility

Jade is a popular WAILA-style overlay for blocks and entities. Its overlay sits at the top of the screen by default, where the OnTime timer can also live (bossbar, top_center, top_left, top_right presets).

Without intervention, the two overlap. OnTime detects Jade automatically at runtime and gently displaces Jade's overlay downward when they would collide, then restores Jade's user-configured position when the timer is gone.


How it works

OnTime never compiles against Jade — the integration is fully reflective, looked up class-by-class on first use:

  1. JadeOverlayManager.isInstalled() checks for snownee.jade.api.config.IWailaConfig on the classpath.
  2. tryInit() walks the config object and resolves accessors for posY, posX, anchorX, anchorY plus the optional rendered-rect field. Each method lookup is wrapped in a guard that catches Throwable, so a missing or renamed Jade class can never crash the host.
  3. On every client tick, JadeClientHook.updateFromTimer() computes the timer's bounding box. If it overlaps Jade's, OnTime calls Jade's setOverlayPosY to move it just below the timer.
  4. When the timer is hidden, finished, or moved to a non-top preset, OnTime restores Jade's previously read posY.

Supported Jade versions

Loader / MC Jade major Layout
Forge 1.20.1 11.x OverlayRenderer without a rect field
Fabric / NeoForge 1.21.1 15.x OverlayRenderer.rect (TooltipRect.rect, Rect2i)
Fabric / NeoForge 1.21.6+ 19.x OverlayRenderer.animation (TooltipAnimation.rect, Rect2f)

The reflective lookup tries both layouts and uses whichever is present. If neither exists (newer Jade with a renamed field), OnTime falls back to estimating Jade's bounding box from anchorX, anchorY, posX, posY and a default size of 100×22 px — coarse but safe.

Anti-flicker safeguards

The first attempts at Jade integration suffered from two recurring issues:

  • Feedback loop. Reading Jade's currently-rendered rect to decide where to push it caused OnTime to chase its own displacement. Fix: prefer the expectedRect (settled position) field when available; estimate from posY/posX/anchor instead of measuring the live rect.
  • NeoForge 1.21.1 re-asserting config. Some Jade versions on NeoForge re-write posY from their config every tick, fighting OnTime's displacement. Fix: while displacing, OnTime ignores Jade's current value entirely and unconditionally enforces its target.

Together these keep the displacement stable — no jitter, no oscillation.

Restore semantics

When OnTime stops displacing, it only restores the user's posY if Jade's current value still matches the value OnTime last wrote. If you edited Jade's config mid-displacement, your value already wins and OnTime won't overwrite it.

On client disconnect, JadeOverlayManager.resetOnDisconnect() does a hard reset: restores any active displacement, re-reads Jade's actual posY (which may now be the "edited mid-game" value), and clears all internal state.


When it kicks in

Displacement is only active when all of the following are true:

  • Jade is installed and tryInit() succeeded.
  • The timer is currently visible (shouldDisplay()).
  • The timer's preset is one of BOSSBAR, TOP_CENTER, TOP_LEFT, TOP_RIGHT.
  • The timer's bounding box would actually overlap Jade's at the user's preferred posY.

For non-top presets (bottom_*, center, actionbar, custom), Jade is never touched.


Logging

When you connect to a world with Jade present, OnTime logs once at INFO level:

[OnTime/Jade] Initialized (userPosY=..., rectAccess=true|false)

rectAccess=true means OnTime found Jade's rendered rect and can use the precise overlap check; false means it fell back to the estimated bounding box. Both modes work; true is just slightly tighter when Jade's content has unusual dimensions.

If Jade is updated to a future version OnTime hasn't seen, you may see a [OnTime/Jade] Init deferred: ... debug line. The integration falls back gracefully — Jade still works, but no displacement happens.


Disabling

There is no toggle. To opt out of displacement, set the timer's position to a non-top preset (bottom_center, center, etc.). The overlay will draw freely without touching Jade.

If you want OnTime to never look at Jade at all, the only way is to remove Jade from the modpack — the integration is unconditional when Jade is on the classpath, but harmless when it isn't.

Clone this wiki locally