Package de.ellpeck.rockbottom.api
Class RockBottomAPI
java.lang.Object
de.ellpeck.rockbottom.api.RockBottomAPI
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LoggercreateLogger(String name) Convenience call toIApiHandler.createLogger(String)that creates aLoggerwith a specified name.static IApiHandlerReturns theIApiHandlerobject initialized by the game on startup.static IContentPackLoaderReturns theIContentPackLoaderobject initialized by the game on startup.static IEventHandlerReturns theIEventHandlerobject initialized by the game on startup.static IGameInstancegetGame()Returns theIGameInstanceobject initialized as the game on startup.static IInternalHooksReturns theIInternalHooksobject initialized by the game on startup.static IModLoaderReturns theIModLoaderobject initialized by the game on startup.static INetHandlergetNet()Returns theINetHandlerobject initialized by the game on startup.static IResourceRegistryReturns theIResourceRegistryobject initialized by the game on startup.static Loggerlogger()Convenience call toIInternalHooks.logger()that returns the game's internal loggerstatic voidsetInternals(Internals intern) This is an internal method that sets all of the important game-related constants like theIGameInstanceorIApiHandler.
-
Field Details
-
VERSION
The current API version equal to the version in the build.gradle file.- See Also:
-
-
Constructor Details
-
RockBottomAPI
public RockBottomAPI()
-
-
Method Details
-
getApiHandler
Returns theIApiHandlerobject 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
Returns theINetHandlerobject 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
Returns theIEventHandlerobject 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
Returns theIGameInstanceobject initialized as the game on startup. This is also an instance of theIModthat 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
Returns theIModLoaderobject 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
Returns theIContentPackLoaderobject 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
Returns theIResourceRegistryobject 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
Returns theIInternalHooksobject 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
Convenience call toIApiHandler.createLogger(String)that creates aLoggerwith a specified name.- Parameters:
name- The logger's display name- Returns:
- The logger
-
logger
Convenience call toIInternalHooks.logger()that returns the game's internal logger- Returns:
- The game's logger
-
setInternals
This is an internal method that sets all of the important game-related constants like theIGameInstanceorIApiHandler. Do not call this method as it will throw anIllegalStateExceptionat all circumstances- Parameters:
intern- The internals
-