Enum FluidAmount.FluidMergeRounding
java.lang.Object
java.lang.Enum<FluidAmount.FluidMergeRounding>
alexiil.mc.lib.attributes.fluid.amount.FluidAmount.FluidMergeRounding
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<FluidAmount.FluidMergeRounding>
,java.lang.constant.Constable
- Enclosing class:
- FluidAmount
public static enum FluidAmount.FluidMergeRounding extends java.lang.Enum<FluidAmount.FluidMergeRounding>
Specifies how merged
FluidAmount
's should handle rounding.-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description FAIL
Specifies that any fluid amounts that don't completely fit together should fail.MAXIMUM_POSSIBLE
Move only an amount which can be validly moved, leaving the rest in the source.ROUND_CEILING
Always empty the source, but leave the target with (potentially) slightly different amount fluid than the exact sum of the two volumes.ROUND_DOWN
Always empty the source, but leave the target with (potentially) slightly less fluid than the exact sum of the two volumes.ROUND_FLOOR
Always empty the source, but leave the target with (potentially) slightly different amount fluid than the exact sum of the two volumes.ROUND_HALF_DOWN
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.ROUND_HALF_EVEN
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.ROUND_HALF_UP
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.ROUND_UNNECESSARY
Throw anArithmeticException
if the end result needs to be rounded.ROUND_UP
Always empty the source, but leave the target with (potentially) slightly more fluid than the exact sum of the two volumes. -
Field Summary
Fields Modifier and Type Field Description static FluidAmount.FluidMergeRounding
DEFAULT
java.math.RoundingMode
rounding
The rounding mode to use, or null if this requires special handling. -
Method Summary
Modifier and Type Method Description static FluidAmount.FluidMergeRounding
fromRounding(java.math.RoundingMode rounding)
static FluidAmount.FluidMergeRounding
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FluidAmount.FluidMergeRounding[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
FAIL
Specifies that any fluid amounts that don't completely fit together should fail. -
MAXIMUM_POSSIBLE
Move only an amount which can be validly moved, leaving the rest in the source. (As such fluid will never be lost, but you might get some leftovers). -
ROUND_UP
Always empty the source, but leave the target with (potentially) slightly more fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofUP
. -
ROUND_DOWN
Always empty the source, but leave the target with (potentially) slightly less fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofDOWN
. -
ROUND_CEILING
Always empty the source, but leave the target with (potentially) slightly different amount fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofUP
. -
ROUND_FLOOR
Always empty the source, but leave the target with (potentially) slightly different amount fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofFLOOR
. -
ROUND_HALF_UP
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofHALF_UP
. -
ROUND_HALF_DOWN
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofHALF_DOWN
. -
ROUND_HALF_EVEN
Always empty the source, but leave the target with (potentially) slightly different amount of fluid than the exact sum of the two volumes.Use
FluidAmount.safeAdd(FluidAmount, RoundingMode)
with aRoundingMode
ofHALF_EVEN
. -
ROUND_UNNECESSARY
Throw anArithmeticException
if the end result needs to be rounded.
-
-
Field Details
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
fromRounding
public static FluidAmount.FluidMergeRounding fromRounding(@Nullable java.math.RoundingMode rounding)
-