Class FluidVariantRendering

java.lang.Object
net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering

public final class FluidVariantRendering extends Object
Client-side display of fluid variants.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getColor(FluidVariant fluidVariant)
    Return the position-independent color that should be used to render the sprite of the passed fluid variant.
    static int
    getColor(FluidVariant fluidVariant, @Nullable net.minecraft.client.renderer.block.BlockAndTintGetter view, @Nullable net.minecraft.core.BlockPos pos)
    Return the color that should be used when rendering the sprite of the passed fluid variant.
    static @Nullable FluidVariantRenderHandler
    getHandler(net.minecraft.world.level.material.Fluid fluid)
    Return the render handler for the passed fluid, if available, and null otherwise.
    getHandlerOrDefault(net.minecraft.world.level.material.Fluid fluid)
    Return the render handler for the passed fluid, if available, or the default instance otherwise.
    static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite
    getSprite(FluidVariant fluidVariant)
    Return the still sprite that should be used to render the passed fluid variant, or null if it's not available.
    static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite[]
    getSprites(FluidVariant fluidVariant)
    Return the still and the flowing sprite that should be used to render the passed fluid variant, or null if they are not available.
    static List<net.minecraft.network.chat.Component>
    getTooltip(FluidVariant fluidVariant)
    Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available and the id of the fluid if advanced tooltips are enabled.
    static List<net.minecraft.network.chat.Component>
    getTooltip(FluidVariant fluidVariant, net.minecraft.world.item.TooltipFlag flag)
    Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available and the id of the fluid if advanced tooltips are enabled.
    static void
    register(net.minecraft.world.level.material.Fluid fluid, FluidVariantRenderHandler handler)
    Register a render handler for the passed fluid.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • register

      public static void register(net.minecraft.world.level.material.Fluid fluid, FluidVariantRenderHandler handler)
      Register a render handler for the passed fluid.
    • getHandler

      public static @Nullable FluidVariantRenderHandler getHandler(net.minecraft.world.level.material.Fluid fluid)
      Return the render handler for the passed fluid, if available, and null otherwise.
    • getHandlerOrDefault

      public static FluidVariantRenderHandler getHandlerOrDefault(net.minecraft.world.level.material.Fluid fluid)
      Return the render handler for the passed fluid, if available, or the default instance otherwise.
    • getTooltip

      public static List<net.minecraft.network.chat.Component> getTooltip(FluidVariant fluidVariant)
      Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available and the id of the fluid if advanced tooltips are enabled.

      Compared to the other overload, the current tooltip context is automatically used.

    • getTooltip

      public static List<net.minecraft.network.chat.Component> getTooltip(FluidVariant fluidVariant, net.minecraft.world.item.TooltipFlag flag)
      Return a mutable list: the tooltip for the passed fluid variant, including the name and additional lines if available and the id of the fluid if advanced tooltips are enabled.
    • getSprites

      public static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite[] getSprites(FluidVariant fluidVariant)
      Return the still and the flowing sprite that should be used to render the passed fluid variant, or null if they are not available. The sprites should be rendered using the color returned by getColor(FluidVariant).
      See Also:
    • getSprite

      public static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite getSprite(FluidVariant fluidVariant)
      Return the still sprite that should be used to render the passed fluid variant, or null if it's not available. The sprite should be rendered using the color returned by getColor(FluidVariant).
    • getColor

      public static int getColor(FluidVariant fluidVariant)
      Return the position-independent color that should be used to render the sprite of the passed fluid variant.
    • getColor

      public static int getColor(FluidVariant fluidVariant, @Nullable net.minecraft.client.renderer.block.BlockAndTintGetter view, @Nullable net.minecraft.core.BlockPos pos)
      Return the color that should be used when rendering the sprite of the passed fluid variant.

      If the level and the position parameters are null, a position-independent color is returned. If the level and position parameters are not null, the color may depend on the position. For example, if level and position are passed, water will use them to return a biome-dependent color.