Class RegisterGameTestsEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.RegisterGameTestsEvent
All Implemented Interfaces:
IModBusEvent

public class RegisterGameTestsEvent extends net.minecraftforge.eventbus.api.Event implements IModBusEvent
Game tests are registered on client or server startup. It is only run once for a given instance of the game if ForgeGameTestHooks.isGametestEnabled() returns true. This is the preferred way to register your game tests.

Fired on the Mod bus, see IModBusEvent.

  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event

    net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Set<Method>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegisterGameTestsEvent(Set<Method> gameTestMethods)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    register(Class<?> testClass)
    Registers an entire class to the game test registry.
    void
    register(Method testMethod)
    Registers a single method to the game test registry.

    Methods inherited from class net.minecraftforge.eventbus.api.Event

    getListenerList, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup

    Methods inherited from class java.lang.Object

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

    • gameTestMethods

      private final Set<Method> gameTestMethods
  • Constructor Details

    • RegisterGameTestsEvent

      public RegisterGameTestsEvent(Set<Method> gameTestMethods)
  • Method Details

    • register

      public void register(Class<?> testClass)
      Registers an entire class to the game test registry. All methods annotated with GameTest or GameTestGenerator will be registered. If the set of enabled namespaces is non-empty, a method will only be registered if its template namespace is in an enabled namespace.
      Parameters:
      testClass - the test class to register to the game test registry
    • register

      public void register(Method testMethod)
      Registers a single method to the game test registry. The method will only be registered if it is annotated with GameTest or GameTestGenerator. If the set of enabled namespaces is non-empty, the method will only be registered if its template namespace is an enabled namespace.
      Parameters:
      testMethod - the test method to register to the game test registry