Class DevAgent

java.lang.Object
net.neoforged.fml.startup.DevAgent

public final class DevAgent extends Object
Our javaagent which we attach to the JVM to be able to add opens/exports to modules when the receiving modules aren't defined at boot time, and we can't use JVM CLI args. It's also useful for JUnit scenarios, where adding JVM arguments for IDEs is very annoying.
  • Field Details

  • Constructor Details

    • DevAgent

      private DevAgent()
  • Method Details

    • getInstrumentation

      public static Instrumentation getInstrumentation()
      Invoked only from InstrumentationHelper. Needs to be public because it makes it easier for reflection to access it.
    • premain

      public static void premain(String arguments, Instrumentation instrumentation)
      This method is called when the agent was added to the JVMs command line arguments.
    • agentmain

      public static void agentmain(String arguments, Instrumentation instrumentation)
      This method is called when the agent was dynamically attached.