JsMacrosClient
com.jsmacrosce.jsmacros.client.JsMacrosClient
Client-side core, menu-key, screen-state, and screen-naming utilities; scripts can access this class through Java.type, not a global library alias.
js
const ClientState = Java.type('com.jsmacrosce.jsmacros.client.JsMacrosClient');
const screen = ClientState.prevScreen;
if (screen !== null) {
Chat.log(ClientState.getScreenName(screen));
}Constructors
new JsMacrosClient
new JsMacrosClient()#Fields
clientCore
Client scripting core, with configuration rooted at the client config directory and scripts in its
Macros child.keyBinding
static keyBinding: KeyMapping#Menu key mapping, initially bound to
K in keyBindingCategory; assigning this field does not itself register a mapping.keyBindingCategory
prevScreen
static prevScreen: BaseScreen#Cached macro UI screen, initially
null; it is reused when the menu key opens the UI.Methods
getKeyText
Resolves a native input-key name to its display component, falling back to a literal component containing the input on lookup or display failure.
Parameters:
translationKey: native key name, such askey.keyboard.k
Returns: the key display component, or a literal component containing
translationKey if resolution failsgetScreenName
Returns a screen label: recognized containers use fixed labels such as "Survival Inventory" or a row-count chest label, unrecognized containers use their fully qualified runtime class name, and chat uses "Chat". Other screens use their nonempty title text, or "unknown" when the title is null or empty. The fixed labels are not localized, and the result is not a unique screen identifier.
Parameters:
s: screen to name, or null
Returns: the selected label, or null when s is null
onInitializeClient
static onInitializeClient(): void#Performs loader client setup: attempts configuration registration, clears the movement queue, optionally starts service reload listening, initializes packet-buffer helpers, then registers a quit-event shutdown hook. Handled reflection and I/O failures during configuration registration are printed before continuing; later failures can abort the remaining steps. Every call that reaches shutdown-hook registration adds another hook, so this is not an idempotent reinitialization API.