Class SingleUseTank

java.lang.Object
net.neoforged.neoforge.fluids.capability.templates.FluidTank
org.cyclops.cyclopscore.fluid.Tank
org.cyclops.cyclopscore.fluid.SingleUseTank
All Implemented Interfaces:
net.neoforged.neoforge.fluids.capability.IFluidHandler, net.neoforged.neoforge.fluids.IFluidTank, IFluidHandlerCapacity, IFluidHandlerMutable

public class SingleUseTank extends Tank
A simple tank that can accept and drain fluids until the capacity is reached. Only one fluid can be accepted, which must be specified with setAcceptedFluid(Fluid). Based on the Buildcraft SingleUseTank.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.neoforged.neoforge.fluids.capability.IFluidHandler

    net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The NBT name for the fluid tank.

    Fields inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank

    capacity, fluid, validator
  • Constructor Summary

    Constructors
    Constructor
    Description
    SingleUseTank(int capacity)
    Make a new tank instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a dirty marking listener.
    net.neoforged.neoforge.fluids.FluidStack
    drain(int maxDrain, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
     
    net.neoforged.neoforge.fluids.FluidStack
    drain(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
     
    int
    fill(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
     
    net.minecraft.world.level.material.Fluid
    Get the accepted fluid for this tank.
    void
    readTankFromNBT(net.minecraft.nbt.CompoundTag nbt)
    Read the tank contents from NBT.
    void
    Remove a dirty marking listener.
    void
    Reset the tank by setting the inner fluid to null.
    protected void
     
    void
    setAcceptedFluid(net.minecraft.world.level.material.Fluid fluid)
    Set the accepted fluid for this tank.
    void
    writeTankToNBT(net.minecraft.nbt.CompoundTag nbt)
    Write the tank contents to NBT.

    Methods inherited from class net.neoforged.neoforge.fluids.capability.templates.FluidTank

    getCapacity, getFluid, getFluidAmount, getFluidInTank, getSpace, getTanks, isFluidValid, isFluidValid, onContentsChanged, setCapacity, setFluid, setValidator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.neoforge.fluids.capability.IFluidHandler

    getFluidInTank, getTanks, isFluidValid
  • Field Details

  • Constructor Details

    • SingleUseTank

      public SingleUseTank(int capacity)
      Make a new tank instance.
      Parameters:
      capacity - The capacity (mB) for the tank.
  • Method Details

    • addDirtyMarkListener

      public void addDirtyMarkListener(IDirtyMarkListener dirtyMarkListener)
      Add a dirty marking listener.
      Parameters:
      dirtyMarkListener - The dirty mark listener.
    • removeDirtyMarkListener

      public void removeDirtyMarkListener(IDirtyMarkListener dirtyMarkListener)
      Remove a dirty marking listener.
      Parameters:
      dirtyMarkListener - The dirty mark listener.
    • fill

      public int fill(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
      Specified by:
      fill in interface net.neoforged.neoforge.fluids.capability.IFluidHandler
      Specified by:
      fill in interface net.neoforged.neoforge.fluids.IFluidTank
      Overrides:
      fill in class net.neoforged.neoforge.fluids.capability.templates.FluidTank
    • drain

      public net.neoforged.neoforge.fluids.FluidStack drain(int maxDrain, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
      Specified by:
      drain in interface net.neoforged.neoforge.fluids.capability.IFluidHandler
      Specified by:
      drain in interface net.neoforged.neoforge.fluids.IFluidTank
      Overrides:
      drain in class net.neoforged.neoforge.fluids.capability.templates.FluidTank
    • drain

      public net.neoforged.neoforge.fluids.FluidStack drain(net.neoforged.neoforge.fluids.FluidStack resource, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action)
      Specified by:
      drain in interface net.neoforged.neoforge.fluids.capability.IFluidHandler
      Specified by:
      drain in interface net.neoforged.neoforge.fluids.IFluidTank
      Overrides:
      drain in class net.neoforged.neoforge.fluids.capability.templates.FluidTank
    • sendUpdate

      protected void sendUpdate()
    • reset

      public void reset()
      Reset the tank by setting the inner fluid to null.
    • setAcceptedFluid

      public void setAcceptedFluid(net.minecraft.world.level.material.Fluid fluid)
      Set the accepted fluid for this tank.
      Parameters:
      fluid - The accepted fluid
    • getAcceptedFluid

      public net.minecraft.world.level.material.Fluid getAcceptedFluid()
      Get the accepted fluid for this tank.
      Returns:
      The accepted fluid.
    • writeTankToNBT

      public void writeTankToNBT(net.minecraft.nbt.CompoundTag nbt)
      Description copied from class: Tank
      Write the tank contents to NBT.
      Overrides:
      writeTankToNBT in class Tank
      Parameters:
      nbt - The NBT tag to write to.
    • readTankFromNBT

      public void readTankFromNBT(net.minecraft.nbt.CompoundTag nbt)
      Description copied from class: Tank
      Read the tank contents from NBT.
      Overrides:
      readTankFromNBT in class Tank
      Parameters:
      nbt - The NBT tag to write from.