Class FluidRenderingRegistry

java.lang.Object
net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderingRegistry

public final class FluidRenderingRegistry extends Object
Registry for FluidModel and FluidRenderHandler instances.

Notably, this supports querying, overriding and wrapping vanilla fluid rendering.

  • Method Summary

    Modifier and Type
    Method
    Description
    get(net.minecraft.world.level.material.Fluid fluid)
    Get a FluidRenderHandler for a given Fluid.
    static @Nullable FluidRenderHandler
    getOverride(net.minecraft.world.level.material.Fluid fluid)
    Get a FluidRenderHandler for a given Fluid, if it is not the default implementation.
    static boolean
    isBlockTransparent(net.minecraft.world.level.block.Block block)
    Looks up whether a block is transparent and gets a fluid overlay texture instead of a falling fluid texture.
    static void
    register(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.block.FluidModel.Unbaked model)
    Register a FluidModel.Unbaked for a given Fluid.
    static void
    register(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.block.FluidModel.Unbaked model, FluidRenderHandler renderer)
    Register a FluidModel.Unbaked and FluidRenderHandler for a given Fluid.
    static void
    register(net.minecraft.world.level.material.Fluid still, net.minecraft.world.level.material.Fluid flow, net.minecraft.client.renderer.block.FluidModel.Unbaked model)
    Register a FluidModel.Unbaked for two given Fluids, usually a pair of a still and a flowing fluid type that use the same fluid renderer.
    static void
    register(net.minecraft.world.level.material.Fluid still, net.minecraft.world.level.material.Fluid flow, net.minecraft.client.renderer.block.FluidModel.Unbaked model, FluidRenderHandler renderer)
    Register a FluidModel.Unbaked and FluidRenderHandler for two given Fluids, usually a pair of a still and a flowing fluid type that use the same fluid renderer.
    static void
    setBlockTransparency(net.minecraft.world.level.block.Block block, boolean transparent)
    Registers whether a block is transparent or not.

    Methods inherited from class Object

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

    • get

      public static FluidRenderHandler get(net.minecraft.world.level.material.Fluid fluid)
      Get a FluidRenderHandler for a given Fluid.

      Returns null if no handler is registered for the fluid.

      Parameters:
      fluid - The Fluid.
      Returns:
      The FluidRenderHandler.
    • getOverride

      public static @Nullable FluidRenderHandler getOverride(net.minecraft.world.level.material.Fluid fluid)
      Get a FluidRenderHandler for a given Fluid, if it is not the default implementation. Supports vanilla and Fabric fluids.
      Parameters:
      fluid - The Fluid.
      Returns:
      The FluidRenderHandler.
    • register

      public static void register(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.block.FluidModel.Unbaked model, FluidRenderHandler renderer)
      Register a FluidModel.Unbaked and FluidRenderHandler for a given Fluid.

      Note that most fluids have a still and a flowing type, and a FluidRenderHandler must be registered for each type separately. To easily register a render handler for a pair of still and flowing fluids, use register(Fluid, Fluid, FluidModel.Unbaked, FluidRenderHandler).

      Parameters:
      fluid - The Fluid.
      model - The FluidModel.Unbaked to use for the fluid.
      renderer - The FluidRenderHandler.
    • register

      public static void register(net.minecraft.world.level.material.Fluid fluid, net.minecraft.client.renderer.block.FluidModel.Unbaked model)
      Register a FluidModel.Unbaked for a given Fluid.

      Note that most fluids have a still and a flowing type, and a model must be registered for each type separately. To easily register a render handler for a pair of still and flowing fluids, use register(Fluid, Fluid, FluidModel.Unbaked).

      Parameters:
      fluid - The Fluid.
      model - The FluidModel.Unbaked to use for the fluid.
    • register

      public static void register(net.minecraft.world.level.material.Fluid still, net.minecraft.world.level.material.Fluid flow, net.minecraft.client.renderer.block.FluidModel.Unbaked model, FluidRenderHandler renderer)
      Register a FluidModel.Unbaked and FluidRenderHandler for two given Fluids, usually a pair of a still and a flowing fluid type that use the same fluid renderer.
      Parameters:
      still - The still Fluid.
      flow - The flowing Fluid.
      model - The FluidModel.Unbaked to use for the fluid.
      renderer - The FluidRenderHandler.
    • register

      public static void register(net.minecraft.world.level.material.Fluid still, net.minecraft.world.level.material.Fluid flow, net.minecraft.client.renderer.block.FluidModel.Unbaked model)
      Register a FluidModel.Unbaked for two given Fluids, usually a pair of a still and a flowing fluid type that use the same fluid renderer.
      Parameters:
      still - The still Fluid.
      flow - The flowing Fluid.
      model - The FluidModel.Unbaked to use for the fluid.
    • setBlockTransparency

      public static void setBlockTransparency(net.minecraft.world.level.block.Block block, boolean transparent)
      Registers whether a block is transparent or not. When a block is transparent, the flowing fluid texture to the sides of that block is replaced by a special overlay texture. This happens by default with glass and leaves, and hence blocks inheriting TransparentBlock and LeavesBlock are by default transparent. Use this method to override the default behavior for a block.
      Parameters:
      block - The block to register transparency for.
      transparent - Whether the block is transparent (e.g. gets the overlay textures) or not.
    • isBlockTransparent

      public static boolean isBlockTransparent(net.minecraft.world.level.block.Block block)
      Looks up whether a block is transparent and gets a fluid overlay texture instead of a falling fluid texture. If transparency is registered for a block (via setBlockTransparency(Block, boolean)), this method returns that registered transparency. Otherwise, this method returns whether the block is a subclass of TransparentBlock or LeavesBlock.
      Parameters:
      block - The block to get transparency for.
      Returns:
      Whether the block is transparent (e.g. gets the overlay textures) or not.