Class BigFluidAmount
java.lang.Object
alexiil.mc.lib.attributes.fluid.amount.BigFluidAmount
- All Implemented Interfaces:
- Comparable<BigFluidAmount>
Exact version of 
FluidAmount. This is generally intended for calculations if the end result should fit into
 a FluidAmount, but the intermediate steps might not.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic BigFluidAmountstatic BigFluidAmountAlways greater than 0.static BigFluidAmountstatic BigFluidAmountstatic BigFluidAmount
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionadd(long by)add(BigFluidAmount by)add(FluidAmount by)asBigInt()doubleConverts this into a normal long-basedFluidAmount.asLongIntRounded(RoundingMode rounding)Converts this into a normal long-basedFluidAmount.Converts this into a normal long-basedFluidAmount.intNull is treated as zerodiv(long by)div(BigFluidAmount by)div(FluidAmount by)booleanequals(BigFluidAmount other)booleanbooleangcd(BigFluidAmount other)gcd(FluidAmount other)inthashCode()booleanisGreaterThan(BigFluidAmount other)Null is treated as zerobooleanisGreaterThanOrEqual(BigFluidAmount other)Null is treated as zerobooleanisLessThan(BigFluidAmount other)Null is treated as zerobooleanisLessThanOrEqual(BigFluidAmount other)Null is treated as zerobooleanbooleanbooleanisZero()lcm(BigFluidAmount other)max(BigFluidAmount other)min(BigFluidAmount other)mul(long by)mul(BigFluidAmount by)mul(FluidAmount by)negate()static BigFluidAmountof(BigInteger numerator, BigInteger denominator)Creates a newFluidAmountwith the given values.static BigFluidAmountof(BigInteger whole, BigInteger numerator, BigInteger denominator)Creates a newFluidAmountwith the given values.intsign()sub(long by)sub(BigFluidAmount by)sub(FluidAmount by)toString()
- 
Field Details- 
ZERO
- 
ONE
- 
NEGATIVE_ONE
- 
BUCKET
- 
BOTTLE
- 
whole
- 
numerator
- 
denominatorAlways greater than 0.
 
- 
- 
Constructor Details- 
BigFluidAmount
 
- 
- 
Method Details- 
ofCreates a newFluidAmountwith the given values. This will reduce the fraction into it's simplest form.
- 
ofCreates a newFluidAmountwith the given values. This will reduce the fraction into it's simplest form.- Throws:
- IllegalArgumentException- if either whole or numerator are negative, or if denominator is less than or equal to 0.
 
- 
isZeropublic boolean isZero()
- 
isNegativepublic boolean isNegative()
- 
isPositivepublic boolean isPositive()
- 
signpublic int sign()- Returns:
- The sign: Either -1 if this is negative, +1 if this is positive, or 0 if this is zero.
 
- 
getDivisor- Returns:
- The denominator represented in a new fraction, as 1/this.denominator.
 
- 
lcm
- 
negate
- 
reciprocal- Returns:
- This fraction, but inverted. (With the numerator and denominator swapped).
 
- 
asLongIntExact- Throws:
- ArithmeticException- if the given values don't fit in a- FluidAmount
 
- 
fitsInLongIntpublic boolean fitsInLongInt()- Returns:
- True if asLongIntExact()will not throw an arithmetic exception.
 
- 
asLongIntSaturatedConverts this into a normal long-basedFluidAmount. If this is too big to fit then this returns eitherFluidAmount.MIN_BUCKETSorFluidAmount.MAX_BUCKETSaccording this thesign().
- 
asLongIntRoundedConverts this into a normal long-basedFluidAmount.If wholeis too large to fit in a long then eitherFluidAmount.MIN_BUCKETSorFluidAmount.MAX_BUCKETSis returned (depending on this sign).Otherwise this is approximately rounded to a valid value. 
- 
asLongIntRoundedConverts this into a normal long-basedFluidAmount.If wholeis too large to fit in a long then eitherFluidAmount.MIN_BUCKETSorFluidAmount.MAX_BUCKETSis returned (depending on this sign).Otherwise this is approximately rounded to a valid value. 
- 
asBigInt
- 
add
- 
add
- 
add
- 
sub
- 
sub
- 
sub
- 
mul
- 
mul
- 
mul
- 
div
- 
div
- 
div
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
- 
equals- Returns:
- True if the number that this FluidAmountrepresents is equal to the number that the givenFluidAmountrepresents.
 
- 
compareToNull is treated as zero- Specified by:
- compareToin interface- Comparable<BigFluidAmount>
 
- 
asInexactDoublepublic double asInexactDouble()
- 
isGreaterThanNull is treated as zero
- 
isGreaterThanOrEqualNull is treated as zero
- 
isLessThanNull is treated as zero
- 
isLessThanOrEqualNull is treated as zero
- 
gcd
- 
gcd
- 
min- Returns:
- The smaller of this value and then given value.
 
- 
max- Returns:
- The greater of this value and then given value.
 
 
-