Class CurvedSpacetimeLoaderQuiltLoader

java.lang.Object
io.codetoil.curved_spacetime.loader.quiltmc.CurvedSpacetimeLoaderQuiltLoader
All Implemented Interfaces:
CurvedSpacetimeLoader

public class CurvedSpacetimeLoaderQuiltLoader extends Object implements CurvedSpacetimeLoader
A loader that delegates to Quilt Loader.

Where the closed-world loader hard-codes its entrypoints so a native image can reach them, this one discovers modules at run time: Quilt reads each module's quilt.mod.json, resolves dependencies, and holds the entrypoint registry that the methods here read from. That makes the Quilt variant the extensible one — modules can be dropped in without rebuilding — at the cost of needing the loader present at run time.

See Also:
  • Constructor Details

    • CurvedSpacetimeLoaderQuiltLoader

      public CurvedSpacetimeLoaderQuiltLoader()
      Creates the loader.

      Holds no state of its own; every lookup is delegated to Quilt Loader.

  • Method Details

    • prepareModInit

      public void prepareModInit(Path path, Object engine)
      Description copied from interface: CurvedSpacetimeLoader
      Prepares this loader for module initialization.

      The engine calls this exactly once, before invoking any entrypoint. An implementation must retain engine such that CurvedSpacetimeLoader.getEngine() returns it thereafter.

      Specified by:
      prepareModInit in interface CurvedSpacetimeLoader
      Parameters:
      path - the run directory modules resolve their resources against
      engine - the engine driving initialization
    • getEntrypoints

      public <E> List<E> getEntrypoints(String name, Class<E> moduleInitializerClass)
      Description copied from interface: CurvedSpacetimeLoader
      Returns every entrypoint registered under the given name whose runtime type is assignable to moduleInitializerClass.

      An implementation returns the same instances across repeated calls within one run. The dependency handshake relies on that: a dependent locates its own main entrypoint by filtering this list, then transfers to the queue owned by that exact object.

      Specified by:
      getEntrypoints in interface CurvedSpacetimeLoader
      Type Parameters:
      E - the entrypoint type
      Parameters:
      name - the entrypoint name, such as main
      moduleInitializerClass - the type registered entrypoints must be assignable to
      Returns:
      the matching entrypoints, empty when the name is recognised but nothing is registered
    • invokeEntrypoints

      public <E> void invokeEntrypoints(String name, Class<E> moduleInitializerClass, Consumer<? super E> moduleInitializerConsumer)
      Description copied from interface: CurvedSpacetimeLoader
      Applies the given consumer to every entrypoint CurvedSpacetimeLoader.getEntrypoints(String, Class) would return for the same arguments.

      No ordering is imposed, and callers must not depend on one.

      Specified by:
      invokeEntrypoints in interface CurvedSpacetimeLoader
      Type Parameters:
      E - the entrypoint type
      Parameters:
      name - the entrypoint name, such as main
      moduleInitializerClass - the type registered entrypoints must be assignable to
      moduleInitializerConsumer - the action to apply to each entrypoint
    • getEngine

      public Object getEngine()
      Description copied from interface: CurvedSpacetimeLoader
      Returns the engine this loader was prepared with.
      Specified by:
      getEngine in interface CurvedSpacetimeLoader
      Returns:
      the engine passed to CurvedSpacetimeLoader.prepareModInit(Path, Object), or null before that call