Skip to content

API Documentation

Ollie Lansdell edited this page Mar 29, 2016 · 3 revisions

Hello,

This page is for the attention of mod developers who wish to add support for their mod with Practical Logistics! Hopefully when it's finished it will detail how every part of the API can be used, until then the majority of the API has detailed comments so you can work out what everything is.

LogisticsAPI.class

  • This class is used for registering all special handlers/info types using the RegistryWrapper.class,

  • This class is also used for integrating with the mod itself, you can access the Cable Helper, Energy Helper, Fluid Helper, Item Helper, InfoHelper and Info Renderer classes. These can be used for doing all types of cool things with the mod which I will cover later.

Registering handlers:
  • All registering should take place in the FMLInitializationEvent

  • Here are some simple examples...

  • LogisticsAPI.getRegistry().registerEnergyHandler(new MyEnergyHandler());

  • LogisticsAPI.getRegistry().registerEnergyType(new MyEnergyType());

  • LogisticsAPI.getRegistry().registerInfoType(new MyInfoType());

Creating Handlers
  • I'm not going to document the process of making handlers since this will be different for every one you want to make however I will detail the different types and what they do.

  • NB: the majority of handlers have a String getName() method, this is the id the handler will be registered under and this must be unique and consistent!

  • Info Types - implements sonar.logistics.api.info.ILogicInfo - This is used for any type of Info displayed on screens, sonar.logistics.api.info.LogicInfo is the most commonly used but others have been made for specific situations. Here you can do customise rendering, saving etc. You can see examples here.

  • Energy Types - implements sonar.logistics.api.utils.EnergyType - This is used for adding custom Energy Types added by other mods, (e.g. RF, EU, MJ, AE). You can see implementations of this inside the EnergyType.class.

  • Interaction Handlers - implements sonar.logistics.api.render.InfoInteractionHandler - These are fairly complex, they are used for enabling interaction with screens, e.g. Inventories. Look at examples here to get a grasp of how they work, they can be pretty frigidity and I may replace the system at some point.

  • Tile Providers - implements sonar.logistics.api.providers.TileProvider - These are for providing Info Types for specific blocks, you can see examples here.

  • Entity Providers - implements sonar.logistics.api.providers.EntityProvider - These are for providing Info Types for given entities, you can see examples here.

  • Inventory Handlers - implements sonar.core.api.InventoryHandler - These are for handling custom inventories, e.g. Barrels, DSU, Storage Drawers, Storage Chambers (from Calculator), you can view examples here.

  • Fluid Handlers - implements sonar.core.api.FluidHandler - These are for handling custom fluid handler, you can view examples here.

  • Energy Handlers - implements sonar.core.api.EnergyHandler - These are for handling custom energy handlers, these are used in conjunction with Energy Types to indicate the type of energy the handler is formatted to, all methods are then relative to that formate, you can view examples here.

Clone this wiki locally