Interface FluidVariant

All Superinterfaces:
TransferVariant<Fluid>

@NonExtendable public interface FluidVariant extends TransferVariant<Fluid>
An immutable association of a still fluid and data components.

Do not extend this class. Use of(Fluid) and of(Fluid, ComponentChanges) to create instances.

FluidVariantRendering can be used for client-side rendering of fluid variants.

Fluid variants must always be compared with equals, never by reference! hashCode is guaranteed to be correct and constant time independently of the size of the components.

  • Field Details

  • Method Details

    • blank

      static FluidVariant blank()
      Retrieve a blank FluidVariant.
    • of

      static FluidVariant of(Fluid fluid)
      Retrieve a FluidVariant with a fluid, and a null tag.

      The flowing and still variations of flowable fluids are normalized to always refer to the still variant. For example, FluidVariant.of(Fluids.FLOWING_WATER).getFluid() == Fluids.WATER.

    • of

      static FluidVariant of(Fluid fluid, ComponentChanges components)
      Retrieve a FluidVariant with a fluid, and an optional tag.

      The flowing and still variations of flowable fluids are normalized to always refer to the still fluid. For example, FluidVariant.of(Fluids.FLOWING_WATER, ComponentChanges.EMPTY).getFluid() == Fluids.WATER.

    • getFluid

      default Fluid getFluid()
      Return the fluid of this variant.
    • getRegistryEntry

      default RegistryEntry<Fluid> getRegistryEntry()
    • withComponentChanges

      FluidVariant withComponentChanges(ComponentChanges changes)
      Creates a copy of this FluidVariant with the provided component changes applied.
      Specified by:
      withComponentChanges in interface TransferVariant<Fluid>
      Parameters:
      changes - the changes to apply
      Returns:
      the new variant with the changes applied