Class AbstractPartialFixedFluidInvView

java.lang.Object
alexiil.mc.lib.attributes.fluid.impl.AbstractPartialFixedFluidInvView
All Implemented Interfaces:
Convertible, FixedFluidInvView
Direct Known Subclasses:
MappedFixedFluidInvView, SubFixedFluidInvView

public abstract class AbstractPartialFixedFluidInvView extends Object implements FixedFluidInvView
  • Field Details

  • Constructor Details

    • AbstractPartialFixedFluidInvView

      protected AbstractPartialFixedFluidInvView(FixedFluidInvView inv)
  • Method Details

    • getInternalTank

      protected abstract int getInternalTank(int tank)
      Returns:
      The tank that the internal inv should use.
    • getInvFluid

      public FluidVolume getInvFluid(int tank)
      Specified by:
      getInvFluid in interface FixedFluidInvView
      Parameters:
      tank - The tank index. Must be a value between 0 (inclusive) and FixedFluidInvView.getTankCount() (exclusive) to be valid. (Like in arrays, lists, etc).
      Returns:
      The FluidVolume that is held in the tank at the moment. The returned volume must never be modified!
    • isFluidValidForTank

      public boolean isFluidValidForTank(int tank, FluidKey fluid)
      Description copied from interface: FixedFluidInvView
      Checks to see if the given fluid would be valid for this tank, ignoring current contents. Note that this method should adhere to the requirements of FluidFilter.matches(FluidKey), so passing empty fluids will generally not return useful results.
      Specified by:
      isFluidValidForTank in interface FixedFluidInvView
      Parameters:
      tank - The tank index. Must be a value between 0 (inclusive) and FixedFluidInvView.getTankCount() (exclusive) to be valid. (Like in arrays, lists, etc).
    • getFilterForTank

      public FluidFilter getFilterForTank(int tank)
      Description copied from interface: FixedFluidInvView
      Exposes FixedFluidInvView.isFluidValidForTank(int, FluidKey) as a (potentially) readable filter.
      Specified by:
      getFilterForTank in interface FixedFluidInvView
      Parameters:
      tank - The tank index. Must be a value between 0 (inclusive) and FixedFluidInvView.getTankCount() (exclusive) to be valid. (Like in arrays, lists, etc).
      Returns:
      An FluidFilter for this tank. If this tank is filtered by an FluidFilter internally then it is highly recommended that this be overridden to return that filter rather than the default opaque wrapper around FixedFluidInvView.isFluidValidForTank(int, FluidKey).
    • getMaxAmount

      @Deprecated(since="0.6.0", forRemoval=true) public int getMaxAmount(int tank)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getMaxAmount in interface FixedFluidInvView
      Parameters:
      tank - The tank index. Must be a value between 0 (inclusive) and FixedFluidInvView.getTankCount() (exclusive) to be valid. (Like in arrays, lists, etc).
      Returns:
      The maximum amount that the given tank can hold of the given fluid. This method will ignore the current stack in FixedFluidInvView.getInvFluid(int). Note that any setters that this object implements (like FixedFluidInv.setInvFluid(int, FluidVolume, Simulation) should reject stacks that are greater than this value. (and callers should only call this if they need to check the amounts separately. Note that it is meaningless to return values greater than the maximum amount an fluid can be stacked to here, and callers are free to throw an exception if this is violated. (Basically huge single-tank inventories shouldn't implement this interface).
    • getMaxAmount_F

      public FluidAmount getMaxAmount_F(int tank)
      Specified by:
      getMaxAmount_F in interface FixedFluidInvView
      Parameters:
      tank - The tank index. Must be a value between 0 (inclusive) and FixedFluidInvView.getTankCount() (exclusive) to be valid. (Like in arrays, lists, etc).
      Returns:
      The maximum amount that the given tank can hold of the given fluid. This method will ignore the current stack in FixedFluidInvView.getInvFluid(int). Note that any setters that this object implements (like FixedFluidInv.setInvFluid(int, FluidVolume, Simulation) should reject stacks that are greater than this value. (and callers should only call this if they need to check the amounts separately. Note that it is meaningless to return values greater than the maximum amount an fluid can be stacked to here, and callers are free to throw an exception if this is violated. (Basically huge single-tank inventories shouldn't implement this interface).