Record Class FluidState
java.lang.Object
java.lang.Record
fr.fidorial.world.fluid.FluidState
- Record Components:
type- the fluid, ornullwhen the block holds nonelevel-0for a source, higher values flowing further from itfalling-truefor fluid falling down a column
-
Constructor Summary
ConstructorsConstructorDescriptionFluidState(@Nullable FluidType type, int level, boolean falling) Creates an instance of aFluidStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the level used to spread,0for sources and falling fluid.static FluidStateempty()Returns the state of a block holding no fluid.final booleanIndicates whether some other object is "equal to" this one.booleanfalling()Returns the value of thefallingrecord component.static FluidStatefallingFluid(FluidType type) Returns a falling block of a fluid.static FluidStateReturns a flowing block of a fluid.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returnstruewhen the block holds no fluid.booleanisSource()Returnstruefor a source block.intlevel()Returns the value of thelevelrecord component.static FluidStateReturns a source block of a fluid.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
FluidState
-
-
Method Details
-
empty
Returns the state of a block holding no fluid.- Returns:
- the state of a block holding no fluid
- Since:
- 0.1.0
-
source
Returns a source block of a fluid.- Parameters:
type- the fluid- Returns:
- a source block of a fluid
- Since:
- 0.1.0
-
flowing
Returns a flowing block of a fluid.- Parameters:
type- the fluidlevel- the level,1next to the source- Returns:
- a flowing block of a fluid
- Since:
- 0.1.0
-
fallingFluid
Returns a falling block of a fluid.- Parameters:
type- the fluid- Returns:
- a falling block of a fluid
- Since:
- 0.1.0
-
isEmpty
public boolean isEmpty()Returnstruewhen the block holds no fluid.- Returns:
truewhen the block holds no fluid- Since:
- 0.1.0
-
isSource
public boolean isSource()Returnstruefor a source block.- Returns:
truefor a source block- Since:
- 0.1.0
-
effectiveLevel
public int effectiveLevel()Returns the level used to spread,0for sources and falling fluid.- Returns:
- the level used to spread,
0for sources and falling fluid - Since:
- 0.1.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
-
level
-
falling
-