Interface ModConstructor

All Known Implementing Classes:
CoolCatCanvasConstructor, CoolCatCoreConstructor

public interface ModConstructor
A mod's common entry point, written once in common code and run the same way on every loader. It's constructed on both sides (client and dedicated server).

Hooking it up:

  • Fabric: list the class under the "coolcatlib:common" entrypoint in fabric.mod.json; no Fabric class is needed.
  • Forge: extend ForgeModEntrypoint in the @Mod class and call common(MyMod::new).
  • Anywhere else: construct(String, Supplier) from the loader's own entry point.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    construct(String modId, Supplier<? extends ModConstructor> factory)
    Constructs a mod's common entry point: onConstructMod() runs right away, onCommonSetup() once the loader is ready.
    default void
    Runs once registries are filled, on the main thread (Forge's common setup; right after construction on Fabric).
    default void
    Runs while mods are constructed: create and register() deferred registers, register payloads, events, configs and reload listeners.
  • Method Details

    • construct

      static void construct(String modId, Supplier<? extends ModConstructor> factory)
      Constructs a mod's common entry point: onConstructMod() runs right away, onCommonSetup() once the loader is ready. Call it while mods are constructed.
    • onConstructMod

      default void onConstructMod()
      Runs while mods are constructed: create and register() deferred registers, register payloads, events, configs and reload listeners.
    • onCommonSetup

      default void onCommonSetup()
      Runs once registries are filled, on the main thread (Forge's common setup; right after construction on Fabric).