Class NeoForgeModEntrypoint

java.lang.Object
net.ixdarklord.coolcatcore.api.core.neoforge.NeoForgeModEntrypoint
Direct Known Subclasses:
NeoForgeClientSetup, NeoForgeSetup

public abstract class NeoForgeModEntrypoint extends Object
A base for a mod's @Mod class that constructs its common mod constructors, taking the mod id from the container. One class covers every side:

 @Mod(MyMod.MOD_ID)
 public final class MyModNeoForge extends NeoForgeModEntrypoint {
     public MyModNeoForge(ModContainer container) {
         super(container);
         this.common(MyMod::new);
         this.client(() -> MyModClient::new);
         this.dataGeneration(MyModData::new);
     }
 }
 
Client and server constructors are given as a supplier of a factory, so their classes are never loaded on the other side. NeoForge-only setup can use container and modEventBus in the same constructor.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final net.neoforged.fml.ModContainer
     
    protected final net.neoforged.bus.api.IEventBus
     
    protected final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    NeoForgeModEntrypoint(net.neoforged.fml.ModContainer container)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    client(Supplier<Supplier<? extends net.ixdarklord.coolcatcore.api.core.ClientModConstructor>> factory)
    Constructs the client entry point, only on a client.
    protected final void
    common(Supplier<? extends net.ixdarklord.coolcatcore.api.core.ModConstructor> factory)
    Constructs the common entry point, on both sides.
    protected final void
    dataGeneration(Supplier<? extends net.ixdarklord.coolcatcore.api.core.DataGenerationConstructor> factory)
    Registers the data generation entry point; the factory is only called when data is generated.
    protected final void
    server(Supplier<Supplier<? extends net.ixdarklord.coolcatcore.api.core.ServerModConstructor>> factory)
    Constructs the dedicated server entry point, only on a dedicated server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • container

      protected final net.neoforged.fml.ModContainer container
    • modEventBus

      protected final net.neoforged.bus.api.IEventBus modEventBus
    • modId

      protected final String modId
  • Constructor Details

    • NeoForgeModEntrypoint

      protected NeoForgeModEntrypoint(net.neoforged.fml.ModContainer container)
  • Method Details

    • common

      protected final void common(Supplier<? extends net.ixdarklord.coolcatcore.api.core.ModConstructor> factory)
      Constructs the common entry point, on both sides.
    • client

      protected final void client(Supplier<Supplier<? extends net.ixdarklord.coolcatcore.api.core.ClientModConstructor>> factory)
      Constructs the client entry point, only on a client.
    • server

      protected final void server(Supplier<Supplier<? extends net.ixdarklord.coolcatcore.api.core.ServerModConstructor>> factory)
      Constructs the dedicated server entry point, only on a dedicated server.
    • dataGeneration

      protected final void dataGeneration(Supplier<? extends net.ixdarklord.coolcatcore.api.core.DataGenerationConstructor> factory)
      Registers the data generation entry point; the factory is only called when data is generated.