pub trait FlowingFluid: FluidBehavior {
// Provided methods
fn base_tick(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
current_fluid: FluidState,
) { ... }
fn base_spread(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
fluid_state: FluidState,
) { ... }
fn base_spread_to(
&self,
world: &Arc<World>,
pos: BlockPos,
fluid_state: FluidState,
) { ... }
fn spread_to(
&self,
world: &Arc<World>,
pos: BlockPos,
fluid_state: FluidState,
_direction: Direction,
) { ... }
fn source_neighbor_count(&self, world: &Arc<World>, pos: BlockPos) -> u8 { ... }
fn spread_to_sides(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
fluid_state: FluidState,
) { ... }
}Expand description
Trait providing the base algorithm for flowing fluids (Water, Lava).
In vanilla Minecraft, this is the FlowingFluid abstract class.
Provided Methods§
Sourcefn base_tick(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
current_fluid: FluidState,
)
fn base_tick( &self, world: &Arc<World>, pos: BlockPos, block_state: BlockStateId, current_fluid: FluidState, )
The base tick logic
Sourcefn base_spread(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
fluid_state: FluidState,
)
fn base_spread( &self, world: &Arc<World>, pos: BlockPos, block_state: BlockStateId, fluid_state: FluidState, )
The base spread logic.
Vanilla equivalent: FlowingFluid.spread().
Sourcefn base_spread_to(
&self,
world: &Arc<World>,
pos: BlockPos,
fluid_state: FluidState,
)
fn base_spread_to( &self, world: &Arc<World>, pos: BlockPos, fluid_state: FluidState, )
The base logic for placing a fluid into a specific adjacent block.
Vanilla equivalent: FlowingFluid.spreadTo().
Note: vanilla’s spreadTo does NOT schedule ticks — that’s handled by
LiquidBlockContainer.placeLiquid or the new block’s onPlace callback.
Sourcefn spread_to(
&self,
world: &Arc<World>,
pos: BlockPos,
fluid_state: FluidState,
_direction: Direction,
)
fn spread_to( &self, world: &Arc<World>, pos: BlockPos, fluid_state: FluidState, _direction: Direction, )
Performs the actual placement of fluid and schedules the tick.
Sourcefn source_neighbor_count(&self, world: &Arc<World>, pos: BlockPos) -> u8
fn source_neighbor_count(&self, world: &Arc<World>, pos: BlockPos) -> u8
Returns the number of fluid sources in the 4-directional neighborhood of the given position.
Sourcefn spread_to_sides(
&self,
world: &Arc<World>,
pos: BlockPos,
block_state: BlockStateId,
fluid_state: FluidState,
)
fn spread_to_sides( &self, world: &Arc<World>, pos: BlockPos, block_state: BlockStateId, fluid_state: FluidState, )
Spreads the fluid to horizontal neighbors.
Vanilla equivalent: FlowingFluid.spreadToSides().
Computes outgoing amount, overrides to 7 for falling fluids, and skips
if the outgoing amount is zero.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".