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 in fabric.mod.json.
  • Forge: client(() -> MyModClient::new) in a ForgeModEntrypoint.
  • Anywhere else: construct(String, Supplier) from client-only code.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    construct(String modId, Supplier<? extends ClientModConstructor> factory)
    Constructs a mod's client entry point: onConstructMod() runs right away, onClientSetup() once the loader is ready.
    default void
    Runs once registries are filled, on the main thread (Forge's client setup; right after construction on Fabric).
    default void
    Runs while mods are constructed: register key mappings, menu screens, tooltip components and client events.
  • Method Details

    • construct

      static void construct(String modId, Supplier<? extends ClientModConstructor> factory)
      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).