Class RockBottomAPI

java.lang.Object
de.ellpeck.rockbottom.api.RockBottomAPI

public final class RockBottomAPI extends Object
The main API class. Use this to access data related to the game's internal workings such as the IApiHandler. See Registries for a list of all of the registries in the game. See GameContent for a list of all the content in the game.
  • Field Details

    • VERSION

      public static final String VERSION
      The current API version equal to the version in the build.gradle file.
      See Also:
  • Constructor Details

    • RockBottomAPI

      public RockBottomAPI()
  • Method Details

    • getApiHandler

      public static IApiHandler getApiHandler()
      Returns the IApiHandler object initialized by the game on startup. The API handler contains a set of useful helper methods that can be used to do various things.
      Returns:
      The API handler
    • getNet

      public static INetHandler getNet()
      Returns the INetHandler object initialized by the game on startup. The net handler contains a set of methods to deal with multiplayer and networking.
      Returns:
      The net handler
    • getEventHandler

      public static IEventHandler getEventHandler()
      Returns the IEventHandler object initialized by the game on startup. The event handler contains a set of methods to deal with subscribing, firing and listening to events.
      Returns:
      The event handler
    • getGame

      public static IGameInstance getGame()
      Returns the IGameInstance object initialized as the game on startup. This is also an instance of the IMod that the game represents. The game instance contains references to the player, the asset manager, the graphics context and various other things.
      Returns:
      The game instance
    • getModLoader

      public static IModLoader getModLoader()
      Returns the IModLoader object initialized by the game on startup. The mod loader contains a set of methods to deal with mod interaction and loading and finding mods.
      Returns:
      The mod loader
    • getContentPackLoader

      public static IContentPackLoader getContentPackLoader()
      Returns the IContentPackLoader object initialized by the game on startup. The content pack loader contains a set of methods to deal with content pack interaction and loading, finding and organizing content packs.
      Returns:
      The content pack loader
    • getResourceRegistry

      public static IResourceRegistry getResourceRegistry()
      Returns the IResourceRegistry object initialized by the game on startup. The resource registry can be used to register resources to be used in construction and various other recipes. The idea of it is that it unifies items to be represented by just a name, so that if, for example, multiple mods add an item representing copper ore, then it can be registered into the resource registry by both mods as "oreCopper" so that recipes can use copper universally.
      Returns:
      The resource registry
    • getInternalHooks

      public static IInternalHooks getInternalHooks()
      Returns the IInternalHooks object initialized by the game on startup. This is an api internal interface used to access methods outside of the API. None of the api internal hooks should be used by mods.
      Returns:
      The internal hooks
    • createLogger

      public static Logger createLogger(String name)
      Convenience call to IApiHandler.createLogger(String) that creates a Logger with a specified name.
      Parameters:
      name - The logger's display name
      Returns:
      The logger
    • logger

      @ApiInternal public static Logger logger()
      Convenience call to IInternalHooks.logger() that returns the game's internal logger
      Returns:
      The game's logger
    • setInternals

      @ApiInternal public static void setInternals(Internals intern)
      This is an internal method that sets all of the important game-related constants like the IGameInstance or IApiHandler. Do not call this method as it will throw an IllegalStateException at all circumstances
      Parameters:
      intern - The internals