Class ForgeModEntrypoint

java.lang.Object
net.ixdarklord.coolcatcore.api.core.forge.ForgeModEntrypoint
Direct Known Subclasses:
ForgeSetup

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

 @Mod(MyMod.MOD_ID)
 public final class MyModForge extends ForgeModEntrypoint {
     public MyModForge(FMLJavaModLoadingContext context) {
         super(context);
         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. Forge-only setup can use context, container and modEventBus in the same constructor.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final net.minecraftforge.fml.ModContainer
     
    protected final net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
     
    protected final net.minecraftforge.eventbus.api.IEventBus
     
    protected final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ForgeModEntrypoint(net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext context)
     
  • 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

    • context

      protected final net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext context
    • container

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

      protected final net.minecraftforge.eventbus.api.IEventBus modEventBus
    • modId

      protected final String modId
  • Constructor Details

    • ForgeModEntrypoint

      protected ForgeModEntrypoint(net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext context)
  • 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.