Package io.papermc.paper.block.fluid
Interface FluidData
- All Superinterfaces:
Cloneable
- All Known Subinterfaces:
FallingFluidData
,FlowingFluidData
A representation of a fluid in a specific state of data.
This type is not linked to a specific location and hence mostly resembles a
BlockData
.-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a copy of this FluidData.computeFlowDirection
(Location location) Computes the direction of the flow of the liquid at the given location as a vector.@org.jetbrains.annotations.Range(from=0L, to=1L) float
computeHeight
(Location location) Computes the height of the fluid in the world.Gets the fluid type of this fluid data.@org.jetbrains.annotations.Range(from=0L, to=8L) int
getLevel()
Returns the level of liquid this fluid data holds.boolean
isSource()
Returns whether this fluid is a source block
-
Method Details
-
getFluidType
Fluid getFluidType()Gets the fluid type of this fluid data.- Returns:
- the fluid type
-
clone
FluidData clone()Returns a copy of this FluidData.- Returns:
- a copy of the fluid data
-
computeFlowDirection
Computes the direction of the flow of the liquid at the given location as a vector.This method requires the passed location's chunk to be loaded. If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation which leads to a potentially slow sync chunk load.
- Parameters:
location
- - the location to check the liquid flow- Returns:
- the flow direction vector at the given location
-
getLevel
@org.jetbrains.annotations.Range(from=0L, to=8L) int getLevel()Returns the level of liquid this fluid data holds.- Returns:
- the amount as an integer, between 0 and 8
-
computeHeight
Computes the height of the fluid in the world.This method requires the passed location's chunk to be loaded. If said chunk is not loaded when this method is called, the chunk will first be loaded prior to the computation which leads to a potentially slow sync chunk load.
- Parameters:
location
- the location at which to check the high of this fluid data.- Returns:
- the height as a float value
-
isSource
boolean isSource()Returns whether this fluid is a source block- Returns:
- true if the fluid is a source block, false otherwise
-