Interfaces

Interfaces

All LiteLoader mods must implement one or more of the LiteMod interfaces in order to be loaded, in general you should add interfaces to your mod class based on the events you want to hook, and should remove any interfaces you are not using, this helps the Loader optimise the callback lists to only include mods which need to receive a particular event callback.

The best way to learn about each interface is to read the source code but a quick summary is provided below

Shared Interfaces

These interfaces can be used on both client and server:

  • LiteMod: the base mod interface, implement this if you just want to be loaded and manage the rest of your lifecycle yourself, all the other interfaces derive from this so if you are implementing any sub interface there's no need to implement this directly
  • Permissible: Allows your mod to leverage the ClientPermissions API, this is an advanced topic and I really need to write a whole tutorial just for this.
  • Configurable: Allows your mod to provide a ConfigPanel which will be accessible via the Mod Info screen
  • PluginChannelListener: provides callbacks to allow your mod to register and use plugin channels.
  • PreJoinGameListener: Provides a callback immediately prior to login (connecting to single player or server).
  • PacketHandler: Allows your mod to handle raw packets
  • ServerPlayerListener: Provides callbacks on the server/in singleplayer when players connect, join and leave the game, and respawn.
  • ServerCommandProvider: Allows a mod to provide commands to the running server instance (including single player).
  • ServerChatFilter: Allows a mod to receive, filter and modify chat messages arriving from clients.

Client Interfaces

These interfaces can only be used at the client:

  • Tickable: provides a callback every frame at the end of the game loop
  • GameLoopListener: Like tickable but called at the start of the game loop.
  • InitCompleteListener: LiteMods get an init() call very early in the game startup process, which can be useful. However sometimes you need to do some initialisation after the game is fully initialised, this interface provides a late initialisation callback that can be used to initialise parts of your mod which need access to the game.
  • RenderListener: provides callbacks at different points in the render loop
  • PostRenderListener: provides additional callbacks at the end of the render loop.
  • EntityRenderListener: provides callbacks before and after entities are rendered
  • HUDRenderListener: provides callbacks before and after the minecraft HUD is rendered.
  • ChatRenderListener: provides callbacks before and after the in-game chat is rendered.
  • ChatListener: allows your mod to monitor incoming chat.
  • ChatFilter: allows your mod to monitor, filter and modify incoming chat.

    This interface must not be used together with ChatListener.

  • OutboundChatListener: allows your mod to monitor chat messages sent by the player.
  • OutboundChatFilter: allows your mod to monitor, filter and modify chat messages sent by the player.
  • FrameBufferListener: Provides callbacks to your mod when Minecraft' main FBO is rendered to the screen
  • ScreenshotListener: Provides a callback when a screenshot is taken
  • JoinGameListener: Provides a callback when the client successfully joins a game (whether single or multiplayer).
  • PostLoginListener: Provides a callback on login (when a successful login response is received from the server).

Login