Interface ClientModConstructor
- All Known Implementing Classes:
CoolCatCanvasClientConstructor,CoolCatCoreClientConstructor
public interface ClientModConstructor
A mod's client entry point, written once in common code. It's only constructed on a client, so it may use
client-only classes.
Hooking it up:
- Fabric: list the class under the
"coolcatlib:client"entrypoint infabric.mod.json. - Forge:
client(() -> MyModClient::new)in aForgeModEntrypoint. - Anywhere else:
construct(String, Supplier)from client-only code.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidconstruct(String modId, Supplier<? extends ClientModConstructor> factory) Constructs a mod's client entry point:onConstructMod()runs right away,onClientSetup()once the loader is ready.default voidRuns once registries are filled, on the main thread (Forge's client setup; right after construction on Fabric).default voidRuns while mods are constructed: register key mappings, menu screens, tooltip components and client events.
-
Method Details
-
construct
Constructs a mod's client entry point:onConstructMod()runs right away,onClientSetup()once the loader is ready. Call it while mods are constructed, and only on a client.- Throws:
IllegalStateException- when this isn't a client
-
onConstructMod
default void onConstructMod()Runs while mods are constructed: register key mappings, menu screens, tooltip components and client events. -
onClientSetup
default void onClientSetup()Runs once registries are filled, on the main thread (Forge's client setup; right after construction on Fabric).
-