Class GuiFluidTank

All Implemented Interfaces:
BackgroundRender, ElementEvents, GuiParent<GuiFluidTank>, TooltipHandler<GuiFluidTank>

public class GuiFluidTank extends GuiElement<GuiFluidTank> implements BackgroundRender
When implementing this tank, you must specify the tank capacity in mb, And then you have two options for specifying the tank contents. You can set the fluid and the amount stored, Or you can provide a FluidStack

Created by brandon3055 on 11/09/2023

  • Field Details

    • DEFAULT_WINDOW

      public static final Material DEFAULT_WINDOW
  • Constructor Details

    • GuiFluidTank

      public GuiFluidTank(@NotNull @NotNull GuiParent<?> parent)
  • Method Details

    • simpleTank

      public static GuiFluidTank.FluidTank simpleTank(@NotNull @NotNull GuiParent<?> parent)
      Creates a simple tank using a simple slot as a background to make it look nice.
    • setCapacity

      public GuiFluidTank setCapacity(long capacity)
      Sets the capacity of this tank in milli-buckets.
    • setCapacity

      public GuiFluidTank setCapacity(Supplier<Long> capacity)
      Supply the capacity of this tank in milli-buckets.
    • setFluidStack

      public GuiFluidTank setFluidStack(net.minecraftforge.fluids.FluidStack fluidStack)
      Allows you to set the current stored fluid stack.
    • setFluidStack

      public GuiFluidTank setFluidStack(Supplier<net.minecraftforge.fluids.FluidStack> fluidStack)
      Allows you to supply the current stored fluid stack.
    • setToolTipFormatter

      public GuiFluidTank setToolTipFormatter(BiFunction<net.minecraftforge.fluids.FluidStack,Long,List<net.minecraft.network.chat.Component>> toolTipFormatter)
      Install a custom formatter to control how the fluid tool tip renders.
    • setWindow

      public GuiFluidTank setWindow(@Nullable @Nullable Material window)
      Sets the tank window texture, Will be tiled to fit the tank size.
      Parameters:
      window - New window texture or null for no window texture.
    • setDrawGauge

      public GuiFluidTank setDrawGauge(boolean drawGauge)
      Enable the built-in fluid gauge lines.
    • setGaugeColour

      public GuiFluidTank setGaugeColour(int gaugeColour)
      Sets the colour of the built-in fluid gauge lines
    • getCapacity

      public Long getCapacity()
    • getFluidStack

      public net.minecraftforge.fluids.FluidStack getFluidStack()
    • renderBackground

      public void renderBackground(GuiRender render, double mouseX, double mouseY, float partialTicks)
      Description copied from interface: BackgroundRender
      Used to render content behind this elements child elements. When rendering element content, always use the PoseStack available via the provided GuiRender Where applicable, always use push/pop to ensure the stack is returned to its original state after your rendering is complete.
      Specified by:
      renderBackground in interface BackgroundRender
      Parameters:
      render - Contains gui context information as well as essential render methods/utils including the PoseStack.
    • defaultFormatter

      public static BiFunction<net.minecraftforge.fluids.FluidStack,Long,List<net.minecraft.network.chat.Component>> defaultFormatter()
    • getColour

      public static int getColour(net.minecraftforge.fluids.FluidStack fluidStack)
    • getColour

      public static int getColour(net.minecraft.world.level.material.Fluid fluid)
    • getStillTexture

      @Nullable public static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite getStillTexture(net.minecraftforge.fluids.FluidStack stack)
    • getStillTexture

      @Nullable public static @Nullable net.minecraft.client.renderer.texture.TextureAtlasSprite getStillTexture(net.minecraft.world.level.material.Fluid fluid)