Class FluidUnit
java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidUnitBase
alexiil.mc.lib.attributes.fluid.volume.FluidUnit
- All Implemented Interfaces:
- Comparable<FluidUnit>
A single unit that a 
 
 There is also 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 toFluidUnitBase.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 | 
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)).- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.FluidUnit(FluidAmount unitAmount, String key)
- 
Method SummaryModifier and TypeMethodDescriptionintnet.minecraft.text.TextgetAmount(FluidAmount amount, boolean forceSingular, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)net.minecraft.text.TextgetEmptyTank(FluidAmount capacity, FluidTooltipContext ctx)net.minecraft.text.TextgetFlowRate(FluidAmount amountPerTick, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)net.minecraft.text.TextgetFullTank(FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)net.minecraft.text.TextgetPartialTank(FluidAmount amount, FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)localizeAmount(FluidAmount amount, boolean forceSingular, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)localizeEmptyTank(FluidAmount capacity, FluidTooltipContext ctx)localizeFlowRate(FluidAmount amountPerTick, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)localizeFullTank(FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)localizePartialTank(FluidAmount amount, FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)Methods inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidUnitBasegetAmount, getAmount, getAmount, getAmount, getAmount, getAmount, getAmount, getEmptyTank, getFlowRate, getFlowRate, getFlowRate, getFullTank, getFullTank, getFullTank, getPartialTank, getPartialTank, getPartialTank, getTank, getTank, getTank, getTank, localizeAmount, localizeAmount, localizeAmount, localizeAmount, localizeAmount, localizeAmount, localizeAmount, localizeEmptyTank, localizeFlowRate, localizeFlowRate, localizeFlowRate, localizeFullTank, localizeFullTank, localizeFullTank, localizePartialTank, localizePartialTank, localizePartialTank, localizeTank, localizeTank, localizeTank, localizeTank
- 
Field Details- 
LOCALE_KEY_PREFIX- See Also:
- Constant Field Values
 
- 
LOCALE_KEY_SUFFIX_SINGLE- See Also:
- Constant Field Values
 
- 
LOCALE_KEY_SUFFIX_MULTIPLE- See Also:
- Constant Field Values
 
- 
LOCALE_KEY_SUFFIX_SYMBOL- See Also:
- Constant Field Values
 
- 
BUCKET
- 
BOTTLE
 
- 
- 
Constructor Details- 
FluidUnitDeprecated, for removal: This API element is subject to removal in a future version.Replaced byFluidUnit(FluidAmount, String).- Parameters:
- key- The name for this unit. (Please refer to- FluidUnit(FluidAmount, String)for the full description of what language keys you need to add).
 
- 
FluidUnit- Parameters:
- key- The name for this unit. You should add 3 language keys to your language file for each separate key you make:
 (But replace "KEY" with the string you pass in here).- Name - Locale Key - Example for Buckets - Example for Ingots - Singular - "libblockattributes.fluid_unit.KEY.singular" - Bucket - Ingot - Plural - "libblockattributes.fluid_unit.KEY.plural" - Buckets - Ingots - Singular - "libblockattributes.fluid_unit.KEY.symbol" - B - I 
 
 
- 
- 
Method Details- 
localizeAmountpublic String localizeAmount(FluidAmount amount, boolean forceSingular, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- localizeAmountin class- FluidUnitBase
 
- 
getAmountpublic net.minecraft.text.Text getAmount(FluidAmount amount, boolean forceSingular, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- getAmountin class- FluidUnitBase
 
- 
localizeEmptyTank- Specified by:
- localizeEmptyTankin class- FluidUnitBase
 
- 
getEmptyTank- Specified by:
- getEmptyTankin class- FluidUnitBase
 
- 
localizeFullTankpublic String localizeFullTank(FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- localizeFullTankin class- FluidUnitBase
 
- 
getFullTankpublic net.minecraft.text.Text getFullTank(FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- getFullTankin class- FluidUnitBase
 
- 
localizePartialTankpublic String localizePartialTank(FluidAmount amount, FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- localizePartialTankin class- FluidUnitBase
 
- 
getPartialTankpublic net.minecraft.text.Text getPartialTank(FluidAmount amount, FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- getPartialTankin class- FluidUnitBase
 
- 
localizeFlowRatepublic String localizeFlowRate(FluidAmount amountPerTick, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- localizeFlowRatein class- FluidUnitBase
 
- 
getFlowRatepublic net.minecraft.text.Text getFlowRate(FluidAmount amountPerTick, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
- getFlowRatein class- FluidUnitBase
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<FluidUnit>
 
 
- 
FluidUnit(FluidAmount, String).