OpenScreen
com.jsmacrosce.jsmacros.client.api.event.impl.player.EventOpenScreen
Fires when the client's current screen changes, including when a screen is closed. The event is dispatched after the screen field is assigned. Reassigning the current screen does not fire it. On close, both screen and screenName are null. Container screens have a separate event that can be cancelled:
EventOpenContainer.
js
JsMacros.on("OpenScreen", JavaWrapper.methodToJava(function (event) {
if (event.screenName === null) {
Chat.log("A screen was closed");
} else {
Chat.log(`Opened ${event.screenName}`);
}
}))Constructors
new EventOpenScreen
Captures the supplied screen and its display name when constructing the event; this does not open or close a screen. A
null screen sets both event fields to null. A non-null screen must implement IScreen, or the cast fails with ClassCastException.Parameters:
screen: the Minecraft screen to capture, ornullwhen closing a screen
Fields
screen
The newly assigned screen, wrapped as an IScreen;
null when a screen is closed. Its class name is available from IScreen.getScreenClassName().screenName
Methods
toString
Returns a diagnostic string containing the event name and captured screen name, in the form
eventName:{"screenName": "name"}. A null screen name is formatted as the literal null; this is not JSON serialization and the screen itself is omitted.Returns: the event name and captured screen name in diagnostic form