Interface FluidVariantRenderHandler


@Experimental @Environment(CLIENT) public interface FluidVariantRenderHandler
Defines how fluid variants of a given Fluid should be displayed to clients. Register with FluidVariantRendering.register(net.minecraft.fluid.Fluid, net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRenderHandler).

Experimental feature, we reserve the right to remove or change it without further notice. The transfer API is a complex addition, and we want to be able to correct possible design mistakes.

  • Method Details

    • getName

      @Deprecated(forRemoval=true) default net.minecraft.text.Text getName(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Implement FluidVariantAttributeHandler.getName(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant) instead. This function will be removed in a future iteration of the API.
    • appendTooltip

      default void appendTooltip(FluidVariant fluidVariant, List<net.minecraft.text.Text> tooltip, net.minecraft.client.item.TooltipContext tooltipContext)
      Append additional tooltips to the passed list if additional information is contained in the fluid variant.

      The name of the fluid, and its identifier if the tooltip context is advanced, should not be appended. They are already added by FluidVariantRendering.getTooltip(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant).

    • getSprites

      @Nullable default @Nullable net.minecraft.client.texture.Sprite[] getSprites(FluidVariant fluidVariant)
      Return an array of size at least 2 containing the sprites that should be used to render the passed fluid variant, for use in baked models, (block) entity renderers, or user interfaces. The first sprite in the array is the still sprite, and the second is the flowing sprite.

      Null may be returned if the fluid variant should not be rendered, but if an array is returned it must have at least two entries and they may not be null.

    • getSprite

      @Deprecated(forRemoval=true) @Nullable default @Nullable net.minecraft.client.texture.Sprite getSprite(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use and implement the other more general overload. This one will be removed in a future iteration of the API.
    • getColor

      @Deprecated(forRemoval=true) default int getColor(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use and implement the other more general overload. This one will be removed in a future iteration of the API.
    • getColor

      default int getColor(FluidVariant fluidVariant, @Nullable @Nullable net.minecraft.world.BlockRenderView view, @Nullable @Nullable net.minecraft.util.math.BlockPos pos)
      Return the color to use when rendering the sprite of this fluid variant. Transparency (alpha) will generally be taken into account and should be specified as well.

      The world and position are optional context parameters and may be null. If they are null, this method must return a location-independent color. If they are provided, this method may return a color that depends on the location. For example, water returns the biome-dependent color if the context parameters are specified, or its default color if one of them is null.

    • fillsFromTop

      @Deprecated(forRemoval=true) default boolean fillsFromTop(FluidVariant fluidVariant)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Implement FluidVariantAttributeHandler.isLighterThanAir(FluidVariant) instead. This function will be removed in a future iteration of the API.