Class FluidUnit

java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidUnitBase
alexiil.mc.lib.attributes.fluid.volume.FluidUnit
All Implemented Interfaces:
java.lang.Comparable<FluidUnit>

public final class FluidUnit
extends FluidUnitBase
implements java.lang.Comparable<FluidUnit>
A single unit that a FluidVolume may be expressed as, for example a bucket or a bottle.

Units are localised according to the key given, prefixed with LOCALE_KEY_PREFIX ("libblockattributes.fluid_unit."), and suffixed with either LOCALE_KEY_SUFFIX_SINGLE (".singular"), LOCALE_KEY_SUFFIX_MULTIPLE (".plural"), or LOCALE_KEY_SUFFIX_SYMBOL (".symbol").

Their are several methods for localising fluid amounts, summarised here:

Name Description Example (long names)
FluidUnitBase.localizeAmount(FluidAmount) Unit name and amount together. The plural name will be used if the amount doesn't equal the unit. 15 Buckets
FluidUnitBase.localizeAmount(FluidAmount, boolean) Similar to the above, but allows you to force the usage of the singular name. 1 Buckets
FluidUnitBase.localizeEmptyTank(FluidAmount) A tank with no fluid contained. Empty 10 Bucket Tank
FluidUnitBase.localizeFullTank(FluidAmount) A tank which is completely full. Full 10 Bucket Tank
FluidUnitBase.localizeTank(FluidAmount, FluidAmount) General-purpose method for all tanks. (If the amount is zero then this delegates to FluidUnitBase.localizeEmptyTank(FluidAmount), and if the amount is equal to the capacity then this delegates to FluidUnitBase.localizeFullTank(FluidAmount)). 3 Buckets in a 10 Bucket Tank
FluidUnitBase.localizeFlowRate(FluidAmount) Flow rate of a fluid, in ticks. (This may use seconds if this has been configured to do so, but the passed amount should always be in ticks, or a 1/20 of a second). 3 Buckets per second
There is also a Text based version of every method above. (For each of the 2 method variants there's also one for each which takes a 1620 fixed-fraction integer-based value (old LBA style)).