Struct FluidStates
pub struct FluidStates<'a> { /* private fields */ }Expand description
The fluid-state facts service, available in setup, reload and world callbacks after keys resolve.
Implementations§
§impl FluidStates<'_>
impl FluidStates<'_>
pub fn definition(&self, fluid: FluidKey) -> Option<FluidDefinition>
pub fn definition(&self, fluid: FluidKey) -> Option<FluidDefinition>
The definition, or none without a resolved registry. Missing prepared world definitions fail resource loading; they are never reported as tank-only.
pub fn type_properties(&self, fluid: FluidKey) -> Option<FluidTypeProperties>
pub fn type_properties(&self, fluid: FluidKey) -> Option<FluidTypeProperties>
The fluid’s type properties, or none without a resolved registry or for a key it
doesn’t hold. Resolve a name with Host::fluid_key, which is none for an unknown one.
pub fn legacy_block(&self, state: FluidState) -> Option<BlockStateId>
pub fn legacy_block(&self, state: FluidState) -> Option<BlockStateId>
FluidState.createLegacyBlock: the block state that holds state in the world, a water
or lava block of the matching level, a mod’s world fluid’s block, or air for the empty
fluid. None for a state no fluid can be in (a tank-only fluid, an amount above 8, a zero
amount for anything but the empty fluid, a source that isn’t full) and without a resolved
registry.
pub fn validate(
&self,
fluid: FluidKey,
constraints: &[StateConstraint],
) -> Result<(), FluidStateError>
pub fn validate( &self, fluid: FluidKey, constraints: &[StateConstraint], ) -> Result<(), FluidStateError>
Validate partial constraints in input order, without matching a particular state.
Tank-only or unavailable definitions return NoWorldState; use definition
to distinguish them. Indices identify the first offending constraint.