Skip to content

Fluid Inv Management

AlexIIL edited this page Apr 10, 2019 · 1 revision

Everything in the "alexiil.mc.lib.attributes.fluid" package is dedicated to fluid management, and is intended for any mod to use. This is heavily based on the item management API, but with a few core changes:

  • Instead of ItemStack we have FluidVolume (with an amount) and FluidKey (without an amount)
  • Slots are called "tanks"
  • Tanks/Slots do not have a pre-defined maximum amount (and neither do fluids themselves as that depends wholly on the container).
  • The units for fluids are based around drips, bottles, and buckets, however custom fluids can use their own units if that makes more sense than the default (buckets).

The core API's are:

  • FixedFluidInv*.
  • FixedFluidInvView* (A read-only version of FixedFluidInv).
  • FluidInvStats* (containing statistics for any fluid inventory).
  • FluidInsertable* (containing fluid insertion)
  • FluidExtractable* (containing fluid extraction)
  • FluidFilter (a Predicate for FluidKey's)
  • FluidInvTankChangeListener (for listening to changes in a FixedItemInvView - although not all implementations will support this).

(*Is an attribute by default)

In addition there are three utility classes:

  • FluidAttributes (containing all of the fluid attributes mentioned above)
  • FluidVolumeUtil (containing general methods around FluidVulume instances that were needed to create this API).
  • FluidWorldUtil (containing methods to obtain a FluidVolume instance from a world).

The "impl" subpackage is also for public use, and it contains a lot of concrete implementations for the core API's.

Clone this wiki locally