Class AbstractPartialFixedFluidInvView
java.lang.Object
alexiil.mc.lib.attributes.fluid.impl.AbstractPartialFixedFluidInvView
- All Implemented Interfaces:
Convertible
,FixedFluidInvView
- Direct Known Subclasses:
MappedFixedFluidInvView
,SubFixedFluidInvView
Base class for
SubFixedFluidInvView
and MappedFixedFluidInvView
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFilterForTank(int tank)
ExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)
as a (potentially) readable filter.protected abstract int
getInternalTank(int tank)
getInvFluid(int tank)
int
getMaxAmount(int tank)
Deprecated, for removal: This API element is subject to removal in a future version.getMaxAmount_F(int tank)
boolean
isFluidValidForTank(int tank, FluidKey fluid)
Checks to see if the given fluid would be valid for this tank, ignoring current contents.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInvView
addListener, convertTo, fluidIterable, getFixedView, getGroupedInv, getMappedInv, getSubInv, getTank, getTankCount, offerSelfAsAttribute, tankIterable
-
Field Details
-
inv
The inventory that is wrapped.
-
-
Constructor Details
-
AbstractPartialFixedFluidInvView
-
-
Method Details
-
getInternalTank
protected abstract int getInternalTank(int tank)- Returns:
- The tank that the internal
inv
should use.
-
getInvFluid
- Specified by:
getInvFluid
in interfaceFixedFluidInvView
- Parameters:
tank
- The tank index. Must be a value between 0 (inclusive) andFixedFluidInvView.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
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 ofFluidFilter.matches(FluidKey)
, so passingempty
fluids will generally not return useful results.- Specified by:
isFluidValidForTank
in interfaceFixedFluidInvView
- Parameters:
tank
- The tank index. Must be a value between 0 (inclusive) andFixedFluidInvView.getTankCount()
(exclusive) to be valid. (Like in arrays, lists, etc).
-
getFilterForTank
Description copied from interface:FixedFluidInvView
ExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)
as a (potentially) readable filter.- Specified by:
getFilterForTank
in interfaceFixedFluidInvView
- Parameters:
tank
- The tank index. Must be a value between 0 (inclusive) andFixedFluidInvView.getTankCount()
(exclusive) to be valid. (Like in arrays, lists, etc).- Returns:
- An
FluidFilter
for this tank. If this tank is filtered by anFluidFilter
internally then it is highly recommended that this be overridden to return that filter rather than the default opaque wrapper aroundFixedFluidInvView.isFluidValidForTank(int, FluidKey)
.
-
getMaxAmount
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
getMaxAmount
in interfaceFixedFluidInvView
- Parameters:
tank
- The tank index. Must be a value between 0 (inclusive) andFixedFluidInvView.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 (likeFixedFluidInv.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
- Specified by:
getMaxAmount_F
in interfaceFixedFluidInvView
- Parameters:
tank
- The tank index. Must be a value between 0 (inclusive) andFixedFluidInvView.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 (likeFixedFluidInv.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).
-