Skip to content

API Functionality

The_Fireplace edited this page Jul 9, 2024 · 5 revisions

Here's a short summary of all the functionality Fireplace Lib offers, separated out by category as it's divided within the API. This list generally expands with each minor update (e.g. 6.2.0 -> 6.3.0)

Chat

  • Translation Service that allows client-side-optional mods to send messages and still allow players' locale settings to be used when possible.
  • Buffering utility for preparing multiline messages, helpful when preparing multiline messages from multiple threads
  • Synchronized message queueing to help avoid overlap with any multiline messages being sent
  • Text pagination utility for a standard paginated chat, complete with buttons to go to the next and previous pages.
  • Library of common text styles

Client

  • Config GUI Entrypoint/Event which registers your config GUI where applicable when a compatible Config GUI library is present. Currently supports Cloth Config (Fabric and Forge) and Mod Menu (Fabric). Mods using FL won't have to use Mod Menu's entrypoint. Support for more mods may be added in the future.
  • ConfigScreenBuilder provides helper methods to reduce redundancy when making common Config GUI components, and allows setting up dependency between config options.
  • FileDialogFactory to easily create file dialogs

Command Utilities

  • Help Command builder for easier custom help commands, with support for sub-commands.
  • Feedback Sender handles sending messages to various kinds of message targets.
  • Requirements Helper provides a few basic types of requirements that are commonly given to commands.
  • Argument Type Factory provides an extra argument type to be used by commands supporting offline players

Environment

  • EnvironmentData allows easily determining some loader-specified information from common module code, such as if it's on a client or dedicated server, or if it's in the dev environment
  • Mod List allows easily reading some basic information about which mods are loaded from common module code.

Inventory

  • Inventory Searcher for easier searching with Minecraft's Inventory interface
  • Inventory Arrangement for rearranging items within an inventory. Currently only has a function to swap contents between two slots.

IO Utilities

  • DirectoryResolver helps easily find commonly needed directories
  • JarFileWalker has utilities for going through the contents of Jar files
  • JsonFileReader turns a json file into a JsonObject.
  • FilePathStorage allows storing keys and associated file paths
  • Config-based and Save-based data storage utilities designed so at some point support can be added for different storage types with no additional changes required from mods that use it.

Lazy IO / Easy Storage Utilities

  • Lazy config and threadsafe savable data system allows for easy creation of config files and save-specific data
  • Save timer that allows setting a save function to run at specified intervals, and automatically runs it before the server stops running
  • ReloadableManager allows reloading supported data from the files. LazyConfig is reloadable, so mods can easily implement commands to reload config without restarting the server.
  • Hierarchical Config and Namespaced Hierarchical Config, which are designed for easily setting up a config system where a default set of settings can be overridden on a case-by-case basis.

Lifecycle

  • Easy way to subscribe to loader-agnostic server lifecycle events

Math

  • Formula parser for parsing generic formula strings.

Multithreading

  • Concurrent Execution Manager provides a convenient way to run tasks on different threads and choose if the server should wait for them to finish when shutting down. Using this for nonessessential threads is still useful because it limits the number of threads running at once to prevent stack overflow errors.

Networking

  • Packet Specification Registry for a way to register packets from Common Code, supporting both Fabric and Forge
  • Packet Sender to send packets registered using this common method

Player

  • Game Profile Finder allows easily looking up GameProfiles using UUID or Player Name.

Teleporter

  • Safe Position utility to help find a good spot to teleport to
  • Teleport wrapper for convenience and ensuring the target chunk is loaded before the teleport functions are called.

Uuid

  • EmptyUUID class to easily get the empty UUID and check if a UUID is empty.