Interface FluidVariantRenderHandler
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 Summary
Modifier and TypeMethodDescriptiondefault 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.default boolean
fillsFromTop
(FluidVariant fluidVariant) Returntrue
if this fluid should fill tanks from top.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.default int
getColor
(FluidVariant fluidVariant, @Nullable net.minecraft.world.BlockRenderView view, @Nullable net.minecraft.util.math.BlockPos pos) Return the color to use when rendering the sprite of this fluid variant.default net.minecraft.text.Text
getName
(FluidVariant fluidVariant) Return the name that should be used for the passed fluid variant.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.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.
-
Method Details
-
getName
Return the name that should be used for the passed fluid variant. -
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, 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
Returntrue
if this fluid should fill tanks from top.
-