pub struct EntityFluidContact {
water_height: f64,
lava_height: f64,
eye_in_water: bool,
eye_in_lava: bool,
water_current: EntityFluidCurrent,
lava_current: EntityFluidCurrent,
}Expand description
Fluid heights intersecting an entity’s current bounding box.
Mirrors the body-height and eye-fluid tracking part of vanilla’s
EntityFluidInteraction. Current pushing should build on this scan rather
than storing separate water/lava flags on individual entity types.
Fields§
§water_height: f64§lava_height: f64§eye_in_water: bool§eye_in_lava: bool§water_current: EntityFluidCurrent§lava_current: EntityFluidCurrentImplementations§
Source§impl EntityFluidContact
impl EntityFluidContact
Sourcepub fn scan(
world: &Arc<World>,
position: DVec3,
eye_y: f64,
bounding_box: WorldAabb,
) -> Self
pub fn scan( world: &Arc<World>, position: DVec3, eye_y: f64, bounding_box: WorldAabb, ) -> Self
Scans the world for water/lava touching bounding_box.
Sourcepub fn scan_with_currents(
world: &Arc<World>,
position: DVec3,
eye_y: f64,
bounding_box: WorldAabb,
include_current: bool,
) -> Self
pub fn scan_with_currents( world: &Arc<World>, position: DVec3, eye_y: f64, bounding_box: WorldAabb, include_current: bool, ) -> Self
Scans fluid contact and optionally accumulates vanilla fluid currents.
Sourcepub const fn water_height(self) -> f64
pub const fn water_height(self) -> f64
Returns the highest water surface above the entity’s feet.
Sourcepub const fn lava_height(self) -> f64
pub const fn lava_height(self) -> f64
Returns the highest lava surface above the entity’s feet.
Sourcepub const fn eye_in_water(self) -> bool
pub const fn eye_in_water(self) -> bool
Returns whether the entity’s eyes are currently inside water.
Sourcepub const fn eye_in_lava(self) -> bool
pub const fn eye_in_lava(self) -> bool
Returns whether the entity’s eyes are currently inside lava.
Sourcepub fn water_current_impulse(
self,
is_player: bool,
old_velocity: DVec3,
scale: f64,
) -> DVec3
pub fn water_current_impulse( self, is_player: bool, old_velocity: DVec3, scale: f64, ) -> DVec3
Returns vanilla water-current impulse for this scan.
Sourcepub fn lava_current_impulse(
self,
is_player: bool,
old_velocity: DVec3,
scale: f64,
) -> DVec3
pub fn lava_current_impulse( self, is_player: bool, old_velocity: DVec3, scale: f64, ) -> DVec3
Returns vanilla lava-current impulse for this scan.
fn scan_bounds(bounding_box: WorldAabb) -> Option<FluidScanBounds>
fn scan_with_bounds( bounds: FluidScanBounds, position: DVec3, eye_y: f64, include_current: bool, fluid_at: impl FnMut(BlockPos) -> FluidState, height_at: impl FnMut(BlockPos, FluidState) -> f32, flow_at: impl FnMut(BlockPos, FluidState) -> DVec3, ) -> Self
Trait Implementations§
Source§impl Clone for EntityFluidContact
impl Clone for EntityFluidContact
Source§fn clone(&self) -> EntityFluidContact
fn clone(&self) -> EntityFluidContact
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EntityFluidContact
Source§impl Debug for EntityFluidContact
impl Debug for EntityFluidContact
Source§impl Default for EntityFluidContact
impl Default for EntityFluidContact
Source§fn default() -> EntityFluidContact
fn default() -> EntityFluidContact
Returns the “default value” for a type. Read more
Source§impl PartialEq for EntityFluidContact
impl PartialEq for EntityFluidContact
impl StructuralPartialEq for EntityFluidContact
Auto Trait Implementations§
impl Freeze for EntityFluidContact
impl RefUnwindSafe for EntityFluidContact
impl Send for EntityFluidContact
impl Sync for EntityFluidContact
impl Unpin for EntityFluidContact
impl UnsafeUnpin for EntityFluidContact
impl UnwindSafe for EntityFluidContact
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>