The Best Resource for Minecraft
The Best Resource for Minecraft

CoFHLib Wiki

CoFHLib is the foundational library mod for Minecraft, providing the essential Redstone Flux (RF) API and shared code frameworks that power the entire TeamCoFH mod suite, including Thermal Expansion and Redstone Arsenal.

6 sections · 668 words

Overview#

CoFHLib (CoFH Common Library) is a critical technical component for Minecraft modding. Developed by TeamCoFH, it serves as a shared repository of code, interfaces, and APIs designed to prevent "reinventing the wheel" across multiple mods. While it does not add player-facing content like mobs or biomes directly to the creative menu, it provides the underlying logic for energy management, fluid handling, and item interactions used by millions of players.

By centralizing essential functions, CoFHLib reduces the memory footprint (PermGen space) of large modpacks and ensures that different mods can communicate seamlessly. It is most famous for housing the Redstone Flux (RF) API, which became the industry standard for power systems in the 1.7.10 era.

Redstone Flux (RF) API#

The Redstone Flux (RF) system is the primary mechanic managed by CoFHLib. It is a standardized energy system used to power machines, tools, and armor. CoFHLib defines how this energy is stored, transmitted, and consumed.

Energy Mechanics

  • Generation: Defined through interfaces that allow blocks (like Dynamos) to produce energy from fuel.
  • Storage: Provides the logic for internal buffers in machines and portable storage items like Flux Capacitors.
  • Transmission: Manages the rules for how energy moves through cables (Fluxducts) or wireless transmitters (Tesseracts).
Feature Description
Standard Unit Redstone Flux (RF)
Transfer Rate Defined by the specific cable or machine interface
Loss Mechanics Typically 0% loss over distance (depending on implementation)
Compatibility Native support for all TeamCoFH mods and hundreds of third-party mods

Shared Item & Block Frameworks#

CoFHLib adds the "blueprints" for several key item and block types. While the physical items appear in mods like Thermal Foundation, their behavior is governed by CoFHLib.

Wrench API (IToolHammer)

CoFHLib defines the standard wrench interface. This allows a single tool (like the Crescent Hammer) to interact with blocks from dozens of different mods. It handles:

  • Dismantling: Safely removing machines with their internal data intact.
  • Rotation: Changing the facing of blocks.
  • Configuration: Toggling modes on pipes and ducts.

Reconfigurable Sides

This mechanic allows blocks to have specialized faces. Through CoFHLib, machines can be programmed to have specific sides for:

  • Input: Accepting items or fluids.
  • Output: Ejecting finished products.
  • Power: Receiving RF energy.

Secure Blocks (ISecurable)

CoFHLib provides the backend for the security system, allowing players to set blocks to Public, Private, or Friends Only access levels using a Signalum Security Lock.

Technical Mechanics#

As a library, CoFHLib handles complex backend operations that ensure game stability and performance.

  • Fluid Handling: Provides a robust framework for transporting liquids (like Steam, Enderium, or Lava) through ducts and storing them in tanks.
  • Inventory Management: Standardizes how machines pull items from adjacent chests or eject them into pipes.
  • Packet Handling: Manages the communication between the server and the client to ensure that machine progress bars and energy levels update accurately in the GUI.
  • Augment System: Defines the logic for "Augments," which are plug-in modules that upgrade machine speed, efficiency, or output.

Mod Integration & Dependencies#

CoFHLib is a mandatory requirement for the following 1.7.10 mods. Without it, these mods will fail to load or crash upon startup:

  • Thermal Expansion: The primary tech mod utilizing the RF API and machine frameworks.
  • Thermal Foundation: Provides the ores, ingots, and fluids that the library manages.
  • Thermal Dynamics: Uses the transport APIs for item, fluid, and energy ducts.
  • Redstone Arsenal: Implements the RF-powered tool and armor interfaces.
  • Vanilla+ Satchels: Utilizes the shared inventory and NBT storage code for portable storage.

Note: In many versions of CoFH Core 1.7.10, CoFHLib is bundled inside the Core jar file, meaning a separate download is not always necessary if CoFH Core is present.

Update History & Maintenance#

CoFHLib received consistent updates throughout the 1.7.10 lifecycle to maintain compatibility with evolving Forge versions and third-party mods.

May 25 Updates

On May 25, 2019, a significant maintenance update was released for the entire CoFH suite. For CoFHLib, this included:

  • Bugfixes: Resolved minor issues with energy synchronization in multiplayer.
  • Tweaks: Improved the efficiency of fluid transport logic.
  • Vanilla+ Integration: Added support for the Void Satchel, a specialized storage item that automatically destroys items placed inside it, useful for automated mining setups.
  • Refactors: Internal code cleanup to improve compatibility with late-stage 1.7.10 modpacks.