Class Declarations
java.lang.Object
com.trevlar.menukit.api.Declarations
Declarations freeze; state does not.
Every mod declares its panels, adapters, tooltip rules and menu chrome from its
initializer, and so do the Kits built on MenuKit (SlotKit's slot groups, operations
and channels; ConfigKit's settings), through this one freeze, so every Kit freezes at
the same moment. Once every entrypoint has run (the first SERVER_STARTING on
a server, CLIENT_STARTED on a client, both before any menu can open), MenuKit
freezes them, and a later declaration throws, the way Minecraft's registries do. A
late declaration used to half-work: listed on one side, unwired on the other, or
taking effect only for screens built after it.
What stays legal is state: a panel shown or hidden, a value written, an index a library fills as menus are built.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidFreezes declarations.static booleanfrozen()Whether declarations have frozen.static voidrequireOpen(String what) Throws if declarations have frozen.
-
Method Details
-
requireOpen
Throws if declarations have frozen. A library built on MenuKit calls this at the top of each of its own declaring methods, so its declarations freeze with MenuKit's.- Parameters:
what- the call being made, for the message ("ScreenPanelAdapter(mymod:toolbar)")
-
frozen
public static boolean frozen()Whether declarations have frozen. -
freeze
Freezes declarations. Called by MenuKit at client start and at the first server start.
-