cpw.mods.fml.common

## Class FMLCommonHandler

- java.lang.Object
- - cpw.mods.fml.common.FMLCommonHandler

-     public class FMLCommonHandler
      extends java.lang.Object

  The main class for non-obfuscated hook handling code Anything that doesn't require obfuscated or client/server specific code should go in this handler It also contains a reference to the sided handler instance that is valid allowing for common code to access specific properties from the obfuscated world without a direct dependency

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FMLCommonHandler()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addModToResourcePack(ModContainer container)`
    `void` | `beginLoading(IFMLSidedHandler handler)`
    `void` | `bootstrap()`
    `EventBus` | `bus()` The FML event bus.
    `void` | `computeBranding()`
    `void` | `confirmBackupLevelDatUse(SaveHandler handler)`
    `void` | `enhanceCrashReport(CrashReport crashReport, CrashReportCategory category)`
    `void` | `expectServerStopped()` Make handleExit() wait for handleServerStopped().
    `ModContainer` | `findContainerFor(java.lang.Object mod)` Find the container that associates with the supplied mod object
    `void` | `fireKeyInput()`
    `void` | `fireMouseInput()`
    `void` | `fireNetRegistrationEvent(NetworkManager manager, java.util.Set<java.lang.String> channelSet, java.lang.String channel, Side side)`
    `void` | `firePlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)`
    `void` | `firePlayerCraftingEvent(EntityPlayer player, ItemStack crafted, IInventory craftMatrix)`
    `void` | `firePlayerItemPickupEvent(EntityPlayer player, EntityItem item)`
    `void` | `firePlayerLoggedIn(EntityPlayer player)`
    `void` | `firePlayerLoggedOut(EntityPlayer player)`
    `void` | `firePlayerRespawnEvent(EntityPlayer player)`
    `void` | `firePlayerSmeltedEvent(EntityPlayer player, ItemStack smelted)`
    `java.util.List<java.lang.String>` | `getBrandings(boolean includeMC)`
    `INetHandler` | `getClientPlayHandler()`
    `NetworkManager` | `getClientToServerNetworkManager()`
    `java.lang.String` | `getCurrentLanguage()`
    `Side` | `getEffectiveSide()` Return the effective side for the context in the game.
    `org.apache.logging.log4j.Logger` | `getFMLLogger()` Get the forge mod loader logging instance (goes to the forgemodloader log file)
    `MinecraftServer` | `getMinecraftServerInstance()`
    `java.lang.String` | `getModName()`
    `java.io.File` | `getSavesDirectory()`
    `Side` | `getSide()`
    `IFMLSidedHandler` | `getSidedDelegate()`
    `void` | `handleExit(int retVal)` Delayed System.exit() until the server is actually stopped/done saving.
    `boolean` | `handleServerAboutToStart(MinecraftServer server)`
    `void` | `handleServerStarted()`
    `boolean` | `handleServerStarting(MinecraftServer server)`
    `void` | `handleServerStopped()`
    `void` | `handleServerStopping()`
    `void` | `handleWorldDataLoad(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)`
    `void` | `handleWorldDataSave(SaveHandler handler, WorldInfo worldInfo, NBTTagCompound tagCompound)`
    `static FMLCommonHandler` | `instance()`
    `void` | `onPlayerPostTick(EntityPlayer player)`
    `void` | `onPlayerPreTick(EntityPlayer player)`
    `void` | `onPostClientTick()`
    `void` | `onPostServerTick()`
    `void` | `onPostWorldTick(World world)` Every tick just after world and other ticks occur
    `void` | `onPreClientTick()`
    `void` | `onPreServerTick()`
    `void` | `onPreWorldTick(World world)` Every tick just before world and other ticks occur
    `void` | `onRenderTickEnd(float timer)`
    `void` | `onRenderTickStart(float timer)`
    `void` | `onServerStart(MinecraftServer dedicatedServer)`
    `void` | `onServerStarted()`
    `void` | `queryUser(StartupQuery query)`
    `void` | `raiseException(java.lang.Throwable exception, java.lang.String message, boolean stopGame)` Raise an exception
    `void` | `registerCrashCallable(ICrashCallable callable)`
    `boolean` | `shouldAllowPlayerLogins()`
    `boolean` | `shouldServerBeKilledQuietly()`
    `void` | `showGuiScreen(java.lang.Object clientGuiElement)`
    `void` | `waitForPlayClient()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FMLCommonHandler

          public FMLCommonHandler()

  - ### Method Detail

    - #### bus

          public EventBus bus()

      The FML event bus. Subscribe here for FML related events
      Returns:
        the event bus

    - #### beginLoading

          public void beginLoading(IFMLSidedHandler handler)

    - #### instance

          public static FMLCommonHandler instance()

      Returns:
        the instance

    - #### findContainerFor

          public ModContainer findContainerFor(java.lang.Object mod)

      Find the container that associates with the supplied mod object
      Parameters:
        `mod` -

    - #### getFMLLogger

          public org.apache.logging.log4j.Logger getFMLLogger()

      Get the forge mod loader logging instance (goes to the forgemodloader log file)
      Returns:
        The log instance for the FML log file

    - #### getSide

          public Side getSide()

    - #### getEffectiveSide

          public Side getEffectiveSide()

      Return the effective side for the context in the game. This is dependent on thread analysis to try and determine whether the code is running in the server or not. Use at your own risk

    - #### raiseException

          public void raiseException(java.lang.Throwable exception,
                            java.lang.String message,
                            boolean stopGame)

      Raise an exception

    - #### computeBranding

          public void computeBranding()

    - #### getBrandings

          public java.util.List<java.lang.String> getBrandings(boolean includeMC)

    - #### getSidedDelegate

          public IFMLSidedHandler getSidedDelegate()

    - #### onPostServerTick

          public void onPostServerTick()

    - #### onPostWorldTick

          public void onPostWorldTick(World world)

      Every tick just after world and other ticks occur

    - #### onPreServerTick

          public void onPreServerTick()

    - #### onPreWorldTick

          public void onPreWorldTick(World world)

      Every tick just before world and other ticks occur

    - #### handleServerAboutToStart

          public boolean handleServerAboutToStart(MinecraftServer server)

    - #### handleServerStarting

          public boolean handleServerStarting(MinecraftServer server)

    - #### handleServerStarted

          public void handleServerStarted()

    - #### handleServerStopping

          public void handleServerStopping()

    - #### getSavesDirectory

          public java.io.File getSavesDirectory()

    - #### getMinecraftServerInstance

          public MinecraftServer getMinecraftServerInstance()

    - #### showGuiScreen

          public void showGuiScreen(java.lang.Object clientGuiElement)

    - #### queryUser

          public void queryUser(StartupQuery query)
                         throws java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### onServerStart

          public void onServerStart(MinecraftServer dedicatedServer)

    - #### onServerStarted

          public void onServerStarted()

    - #### onPreClientTick

          public void onPreClientTick()

    - #### onPostClientTick

          public void onPostClientTick()

    - #### onRenderTickStart

          public void onRenderTickStart(float timer)

    - #### onRenderTickEnd

          public void onRenderTickEnd(float timer)

    - #### onPlayerPreTick

          public void onPlayerPreTick(EntityPlayer player)

    - #### onPlayerPostTick

          public void onPlayerPostTick(EntityPlayer player)

    - #### registerCrashCallable

          public void registerCrashCallable(ICrashCallable callable)

    - #### enhanceCrashReport

          public void enhanceCrashReport(CrashReport crashReport,
                                CrashReportCategory category)

    - #### handleWorldDataSave

          public void handleWorldDataSave(SaveHandler handler,
                                 WorldInfo worldInfo,
                                 NBTTagCompound tagCompound)

    - #### handleWorldDataLoad

          public void handleWorldDataLoad(SaveHandler handler,
                                 WorldInfo worldInfo,
                                 NBTTagCompound tagCompound)

    - #### confirmBackupLevelDatUse

          public void confirmBackupLevelDatUse(SaveHandler handler)

    - #### shouldServerBeKilledQuietly

          public boolean shouldServerBeKilledQuietly()

    - #### expectServerStopped

          public void expectServerStopped()

      Make handleExit() wait for handleServerStopped(). For internal use only!

    - #### handleExit

          public void handleExit(int retVal)

      Delayed System.exit() until the server is actually stopped/done saving. For internal use only!
      Parameters:
        `retVal` - Exit code for System.exit()

    - #### handleServerStopped

          public void handleServerStopped()

    - #### getModName

          public java.lang.String getModName()

    - #### addModToResourcePack

          public void addModToResourcePack(ModContainer container)

    - #### getCurrentLanguage

          public java.lang.String getCurrentLanguage()

    - #### bootstrap

          public void bootstrap()

    - #### getClientToServerNetworkManager

          public NetworkManager getClientToServerNetworkManager()

    - #### fireMouseInput

          public void fireMouseInput()

    - #### fireKeyInput

          public void fireKeyInput()

    - #### firePlayerChangedDimensionEvent

          public void firePlayerChangedDimensionEvent(EntityPlayer player,
                                             int fromDim,
                                             int toDim)

    - #### firePlayerLoggedIn

          public void firePlayerLoggedIn(EntityPlayer player)

    - #### firePlayerLoggedOut

          public void firePlayerLoggedOut(EntityPlayer player)

    - #### firePlayerRespawnEvent

          public void firePlayerRespawnEvent(EntityPlayer player)

    - #### firePlayerItemPickupEvent

          public void firePlayerItemPickupEvent(EntityPlayer player,
                                       EntityItem item)

    - #### firePlayerCraftingEvent

          public void firePlayerCraftingEvent(EntityPlayer player,
                                     ItemStack crafted,
                                     IInventory craftMatrix)

    - #### firePlayerSmeltedEvent

          public void firePlayerSmeltedEvent(EntityPlayer player,
                                    ItemStack smelted)

    - #### getClientPlayHandler

          public INetHandler getClientPlayHandler()

    - #### waitForPlayClient

          public void waitForPlayClient()

    - #### fireNetRegistrationEvent

          public void fireNetRegistrationEvent(NetworkManager manager,
                                      java.util.Set<java.lang.String> channelSet,
                                      java.lang.String channel,
                                      Side side)

    - #### shouldAllowPlayerLogins

          public boolean shouldAllowPlayerLogins()