Class FluidVariantRendering
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering
Client-side display of fluid variants.
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 Summary
Modifier and TypeMethodDescriptionstatic 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 BlockRenderView view, @Nullable BlockPos pos) Return the color that should be used when rendering the sprite of the passed fluid variant.static @Nullable FluidVariantRenderHandler
getHandler
(Fluid fluid) Return the render handler for the passed fluid, if available, andnull
otherwise.static FluidVariantRenderHandler
getHandlerOrDefault
(Fluid fluid) Return the render handler for the passed fluid, if available, or the default instance otherwise.static @Nullable Sprite
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 Sprite[]
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.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.getTooltip
(FluidVariant fluidVariant, TooltipContext context) 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
(Fluid fluid, FluidVariantRenderHandler handler) Register a render handler for the passed fluid.
-
Method Details
-
register
Register a render handler for the passed fluid. -
getHandler
Return the render handler for the passed fluid, if available, andnull
otherwise. -
getHandlerOrDefault
Return the render handler for the passed fluid, if available, or the default instance otherwise. -
getTooltip
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
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
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 bygetColor(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant)
. -
getSprite
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 bygetColor(net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant)
. -
getColor
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 @Nullable BlockRenderView view, @Nullable @Nullable BlockPos pos) Return the color that should be used when rendering the sprite of the passed fluid variant.If the world and the position parameters are null, a position-independent color is returned. If the world and position parameters are not null, the color may depend on the position. For example, if world and position are passed, water will use them to return a biome-dependent color.
-