pub struct FluidState {
pub kind: FluidKind,
pub amount: u8,
pub falling: bool,
}
Fields§
§kind: FluidKind
§amount: u8
0 = empty, 8 = full, 9 = max.
9 is meant to be used when there’s another fluid block of the same type above it, but it’s usually unused by this struct.
This is different from crate::blocks::Water::level
, which is
basically the opposite (0 = full, 8 = empty). You can convert between
the two representations with to_or_from_legacy_fluid_level
.
falling: bool
Whether this fluid is at the max level and there’s another fluid of the same type above it.
TODO: this is currently unused (always false), make this actually get set (see FlowingFluid.getFlowing)
Implementations§
Source§impl FluidState
impl FluidState
pub fn new_source_block(kind: FluidKind, falling: bool) -> Self
Sourcepub fn height(&self) -> f32
pub fn height(&self) -> f32
A floating point number in between 0 and 1 representing the height (as a percentage of a full block) of the fluid.
pub fn is_empty(&self) -> bool
pub fn affects_flow(&self, other: &FluidState) -> bool
pub fn is_same_kind(&self, other: &FluidState) -> bool
Trait Implementations§
Source§impl Clone for FluidState
impl Clone for FluidState
Source§fn clone(&self) -> FluidState
fn clone(&self) -> FluidState
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FluidState
impl Debug for FluidState
Source§impl Default for FluidState
impl Default for FluidState
Source§impl From<BlockState> for FluidState
impl From<BlockState> for FluidState
Source§fn from(state: BlockState) -> Self
fn from(state: BlockState) -> Self
Converts to this type from the input type.
Source§impl From<FluidState> for BlockState
impl From<FluidState> for BlockState
Source§fn from(state: FluidState) -> Self
fn from(state: FluidState) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FluidState
impl RefUnwindSafe for FluidState
impl Send for FluidState
impl Sync for FluidState
impl Unpin for FluidState
impl UnwindSafe for FluidState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more