Class FluidUnitSet
java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidUnitBase
alexiil.mc.lib.attributes.fluid.volume.FluidUnitSet
public final class FluidUnitSet extends FluidUnitBase
Multiple
FluidUnit
s. This can localise a single amount into multiple different units, for example a
FluidAmount of "4 + 1/3" would localize a string like "4 Buckets and 1 Bottle" if the two available units were
FluidUnit.BUCKET
and FluidUnit.BOTTLE
.
While it is possible to construct a custom FluidUnitSet
it's recommended that you use the one that's built in
to every FluidKey
, via FluidKey.unitSet
.
-
Constructor Summary
Constructors Constructor Description FluidUnitSet()
-
Method Summary
Modifier and Type Method Description boolean
addUnit(FluidUnit unit)
FluidUnitSet
copy()
void
copyFrom(FluidUnitSet other)
net.minecraft.text.Text
getAmount(FluidAmount amount, boolean forceLastSingular, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
net.minecraft.text.Text
getEmptyTank(FluidAmount capacity, FluidTooltipContext ctx)
net.minecraft.text.Text
getFlowRate(FluidAmount amountPerTick, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
net.minecraft.text.Text
getFullTank(FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
FluidUnit
getLargestUnit()
net.minecraft.text.Text
getPartialTank(FluidAmount amount, FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
FluidUnit
getSmallestUnit()
java.lang.String
localizeAmount(FluidAmount amount, boolean forceLastSingular, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
java.lang.String
localizeEmptyTank(FluidAmount capacity, FluidTooltipContext ctx)
java.lang.String
localizeFlowRate(FluidAmount amountPerTick, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
java.lang.String
localizeFullTank(FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
java.lang.String
localizePartialTank(FluidAmount amount, FluidAmount capacity, net.minecraft.text.Text fluidName, FluidTooltipContext ctx)
Methods inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidUnitBase
getAmount, 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
-
Constructor Details
-
FluidUnitSet
public FluidUnitSet()
-
-
Method Details
-
copy
-
copyFrom
-
addUnit
- Returns:
- True if the given unit was added, or false if another unit was already present with an amount equal to the given one.
-
getSmallestUnit
- Returns:
- The largest unit in this set. For example if this was [buckets, bottles] then this would return bottles.
-
getLargestUnit
- Returns:
- The largest unit in this set. For example if this was [buckets, bottles] then this would return buckets.
-
localizeAmount
public java.lang.String localizeAmount(FluidAmount amount, boolean forceLastSingular, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
localizeAmount
in classFluidUnitBase
-
getAmount
public net.minecraft.text.Text getAmount(FluidAmount amount, boolean forceLastSingular, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
getAmount
in classFluidUnitBase
-
localizeEmptyTank
- Specified by:
localizeEmptyTank
in classFluidUnitBase
-
getEmptyTank
- Specified by:
getEmptyTank
in classFluidUnitBase
-
localizeFullTank
public java.lang.String localizeFullTank(FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
localizeFullTank
in classFluidUnitBase
-
getFullTank
public net.minecraft.text.Text getFullTank(FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
getFullTank
in classFluidUnitBase
-
localizePartialTank
public java.lang.String localizePartialTank(FluidAmount amount, FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
localizePartialTank
in classFluidUnitBase
-
getPartialTank
public net.minecraft.text.Text getPartialTank(FluidAmount amount, FluidAmount capacity, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
getPartialTank
in classFluidUnitBase
-
localizeFlowRate
public java.lang.String localizeFlowRate(FluidAmount amountPerTick, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
localizeFlowRate
in classFluidUnitBase
-
getFlowRate
public net.minecraft.text.Text getFlowRate(FluidAmount amountPerTick, @Nullable net.minecraft.text.Text fluidName, FluidTooltipContext ctx)- Specified by:
getFlowRate
in classFluidUnitBase
-