IModpublic interface IGameInstance extends IMod
IRenderer and IAssetManager.
Notice that this instance represents both the server and the client, however
some methods that are not implemented on the dedicated server (like graphics
and rendering methods) will throw an UnsupportedOperationException.
To access any methods from this class, use RockBottomAPI.getGame().| Modifier and Type | Method | Description |
|---|---|---|
<T> void |
enqueueAction(java.util.function.BiConsumer<IGameInstance,T> action,
T object) |
Enqueues an action to be executed next tick.
|
void |
exit() |
|
IAssetManager |
getAssetManager() |
Gets the
IAssetManager of the current game instance. |
IChatLog |
getChatLog() |
Gets the
IChatLog of the current game instance. |
java.net.URLClassLoader |
getClassLoader() |
Gets the
URLClassLoader that the game is using to load its own
classes and classes from jars out of the mods folder. |
IDataManager |
getDataManager() |
Gets the
IDataManager of the current game instance. |
java.util.UUID |
getDefaultUniqueId() |
Gets the default
UUID that will be applied to the game while
there is no logged in account. |
int |
getFpsAverage() |
|
IGuiManager |
getGuiManager() |
Gets the
IGuiManager of the current game instance. |
int |
getHeight() |
Gets the current height of the window in pixels
|
IInputHandler |
getInput() |
Gets the
IInputHandler of the current game instance. |
IInteractionManager |
getInteractionManager() |
Gets the
IInteractionManager of the current game instance. |
IParticleManager |
getParticleManager() |
Gets the
IParticleManager of the current game instance. |
AbstractEntityPlayer |
getPlayer() |
Gets the
AbstractEntityPlayer of the current game instance. |
int |
getPlayerCap() |
|
IPlayerDesign |
getPlayerDesign() |
Gets the
IPlayerDesign that defines what the player looks like. |
IRenderer |
getRenderer() |
Gets the
IRenderer context of the current game instance. |
Settings |
getSettings() |
Gets the
Settings of the current game instance. |
float |
getTickDelta() |
|
IToaster |
getToaster() |
Gets the
IToaster of the current game instance. |
int |
getTotalTicks() |
Gets the total amount of ticks the game has been running for.
|
int |
getTpsAverage() |
|
java.util.UUID |
getUniqueId() |
Gets the
UUID of the current game instance. |
int |
getWidth() |
Gets the current width of the window in pixels
|
long |
getWindow() |
Gets the
GLFW pointer to the window that is open. |
IWorld |
getWorld() |
Gets the
IWorld of the current game instance. |
boolean |
isDedicatedServer() |
Gets if the game is currently in dedicated server mode.
|
boolean |
isRunning() |
|
void |
joinWorld(DataSet playerSet,
WorldInfo info,
DynamicRegistryInfo regInfo) |
|
void |
openIngameMenu() |
|
void |
quitWorld() |
|
void |
restart() |
|
void |
setFullscreen(boolean fullscreen) |
|
void |
setPlayerDesign(java.lang.String jsonString) |
|
void |
startWorld(java.io.File worldFile,
WorldInfo info,
boolean isNewlyCreated) |
getAuthors, getContentLocation, getDescription, getDisplayName, getId, getModConfig, getModGuiClass, getResourceLocation, getSortingPriority, getVersion, init, initAssets, isCompatibleWithModVersion, isDisableable, isRequiredOnClient, isRequiredOnServer, postInit, postInitAssets, postPostInit, preInit, preInitAssets, prePreInit@ApiInternal void startWorld(java.io.File worldFile, WorldInfo info, boolean isNewlyCreated)
@ApiInternal void joinWorld(DataSet playerSet, WorldInfo info, DynamicRegistryInfo regInfo)
@ApiInternal void quitWorld()
@ApiInternal void openIngameMenu()
<T> void enqueueAction(java.util.function.BiConsumer<IGameInstance,T> action, T object)
T - A user-chosen generic typ for the passed additional objectaction - The action to be executedobject - An object you can pass for later use in the action
consumerenqueueAction(BiConsumer, Object)IDataManager getDataManager()
IDataManager of the current game instance. This can be
used for accessing locations on disk like the save folder or the game
folder itself. Additionally, it can save IJsonSettings.@ApiInternal void restart()
Settings getSettings()
Settings of the current game instance. These store all
of the values that can be edited in the settings gui.AbstractEntityPlayer getPlayer()
AbstractEntityPlayer of the current game instance. Note
that this is not implemented on the dedicated server.java.lang.UnsupportedOperationException - on the dedicated serverIGuiManager getGuiManager()
IGuiManager of the current game instance. This can be
used to open Guis and fade the screen in and out. Note that this is not
implemented on the dedicated server.java.lang.UnsupportedOperationException - on the dedicated serverIInteractionManager getInteractionManager()
IInteractionManager of the current game instance. This
can be used to access the positions in the world that the player is
currently breaking. Note that this is not implemented on the dedicated
server.java.lang.UnsupportedOperationException - on the dedicated serverIChatLog getChatLog()
IChatLog of the current game instance. This can be used
to write messages and commands into the in-game chat.IWorld getWorld()
IWorld of the current game instance. In the title
screen, this value is unassigned.IAssetManager getAssetManager()
IAssetManager of the current game instance. This can be
used to get graphics, sounds and various other assets. Note that this is
not implemented on the dedicated server.java.lang.UnsupportedOperationException - on the dedicated serverIRenderer getRenderer()
IRenderer context of the current game instance. This can
be used to draw various shapes and interact with the OpenGL context.IParticleManager getParticleManager()
IParticleManager of the current game instance. This can
be used to spawn and render particles. Note that this is not implemented
on the dedicated server.java.lang.UnsupportedOperationException - on the dedicated serverjava.util.UUID getUniqueId()
UUID of the current game instance. This will be applied
to the player as soon as a world starts. Note that the dedicated server
does not have a unique id. In case the current unique id does not exist
for one reason or another, the getDefaultUniqueId() will be
returned.java.lang.UnsupportedOperationException - on the dedicated serverjava.util.UUID getDefaultUniqueId()
UUID that will be applied to the game while
there is no logged in account. This is also the UUID that the default
player will be saved to disk with.@ApiInternal int getTpsAverage()
@ApiInternal int getFpsAverage()
java.net.URLClassLoader getClassLoader()
URLClassLoader that the game is using to load its own
classes and classes from jars out of the mods folder.@ApiInternal void setFullscreen(boolean fullscreen)
int getTotalTicks()
IPlayerDesign getPlayerDesign()
IPlayerDesign that defines what the player looks like.
Note that this is not implemented on the dedicated server.java.lang.UnsupportedOperationException - on the dedicated server@ApiInternal void setPlayerDesign(java.lang.String jsonString)
boolean isDedicatedServer()
IInputHandler getInput()
IInputHandler of the current game instance. This is a
class that allows for the polling of inputs. Note that, when using Keybind, Keybind.isDown() and Keybind.isPressed() should
be used instead. Note that this is not implemented on the dedicated
server.java.lang.UnsupportedOperationException - on the dedicated server@ApiInternal void exit()
IToaster getToaster()
IToaster of the current game instance. This is the
system that displays Toast objects, which are the little pop-up
messages in the top left. Note that this is not implemented on the
dedicated server.java.lang.UnsupportedOperationException - on the dedicated serverint getWidth()
java.lang.UnsupportedOperationException - on the dedicated serverIRenderer.getWidthInGui(),
IRenderer.getWidthInWorld()int getHeight()
java.lang.UnsupportedOperationException - on the dedicated serverIRenderer.getHeightInGui(),
IRenderer.getHeightInWorld()long getWindow()
GLFW pointer to the window that is open.java.lang.UnsupportedOperationException - on the dedicated serverboolean isRunning()
Thread instances that loop.@ApiInternal int getPlayerCap()
float getTickDelta()