Interface FluidVariantRenderHandler
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)
.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
appendTooltip
(FluidVariant fluidVariant, List<Text> tooltip, TooltipType tooltipType) Append additional tooltips to the passed list if additional information is contained in the fluid variant.default int
getColor
(FluidVariant fluidVariant, @Nullable BlockRenderView view, @Nullable BlockPos pos) Return the color to use when rendering the sprites of this fluid variant.default @Nullable 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.
-
Method Details
-
appendTooltip
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
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.
-
getColor
default int getColor(FluidVariant fluidVariant, @Nullable @Nullable BlockRenderView view, @Nullable @Nullable BlockPos pos) Return the color to use when rendering the sprites 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.
-