Class DelegatingFixedFluidInv
java.lang.Object
alexiil.mc.lib.attributes.fluid.impl.DelegatingFixedFluidInv
- All Implemented Interfaces:
- Convertible,- FixedFluidInv,- FixedFluidInvView
- Direct Known Subclasses:
- SimpleLimitedFixedFluidInv
A simple delegate base class for 
FixedFluidInv.- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddListener(FluidInvTankChangeListener listener, ListenerRemovalToken removalToken)Adds the given listener to this inventory, such that theFluidInvTankChangeListener.onChange(FixedFluidInvView, int, FluidVolume, FluidVolume)will be called every time that this inventory changes.getFilterForTank(int tank)ExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)as a (potentially) readable filter.getInvFluid(int tank)intgetMaxAmount(int tank)Deprecated, for removal: This API element is subject to removal in a future version.getMaxAmount_F(int tank)intbooleanisFluidValidForTank(int tank, FluidKey fluid)Checks to see if the given fluid would be valid for this tank, ignoring current contents.booleansetInvFluid(int tank, FluidVolume to, Simulation simulation)Sets the fluid in the given tank to the given fluid.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInvcreateLimitedFixedInv, extractFluid, forceSetInvFluid, getExtractable, getGroupedInv, getInsertable, getMappedInv, getSubInv, getTank, getTransferable, insertFluid, modifyTank, tankIterableMethods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInvViewconvertTo, fluidIterable, getFixedView, offerSelfAsAttribute
- 
Field Details- 
delegate
 
- 
- 
Constructor Details- 
DelegatingFixedFluidInv
 
- 
- 
Method Details- 
getTankCountpublic int getTankCount()- Specified by:
- getTankCountin interface- FixedFluidInvView
- Returns:
- The number of tanks in this inventory.
 
- 
getInvFluid- Specified by:
- getInvFluidin 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!
 
- 
getMaxAmountDeprecated, for removal: This API element is subject to removal in a future version.- Specified by:
- getMaxAmountin 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 (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_Fin 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 (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).
 
- 
isFluidValidForTankDescription copied from interface:FixedFluidInvChecks 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 passingemptyfluids will generally not return useful results.Note that just because an FluidKeypasses this validity test, and is mergable with the current fluid, does not mean that you can insert the fluid into this inventory.- Specified by:
- isFluidValidForTankin interface- FixedFluidInv
- Specified by:
- isFluidValidForTankin 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).
 
- 
getFilterForTankDescription copied from interface:FixedFluidInvViewExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)as a (potentially) readable filter.- Specified by:
- getFilterForTankin 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 FluidFilterfor this tank. If this tank is filtered by anFluidFilterinternally then it is highly recommended that this be overridden to return that filter rather than the default opaque wrapper aroundFixedFluidInvView.isFluidValidForTank(int, FluidKey).
 
- 
addListenerpublic ListenerToken addListener(FluidInvTankChangeListener listener, ListenerRemovalToken removalToken)Description copied from interface:FixedFluidInvViewAdds the given listener to this inventory, such that theFluidInvTankChangeListener.onChange(FixedFluidInvView, int, FluidVolume, FluidVolume)will be called every time that this inventory changes. However if this inventory doesn't support listeners then this will return a nulltoken.- Specified by:
- addListenerin interface- FixedFluidInvView
- removalToken- A token that will be called whenever the given listener is removed from this inventory (or if this inventory itself is unloaded or otherwise invalidated).
- Returns:
- A token that represents the listener, or null if the listener could not be added.
 
- 
setInvFluidDescription copied from interface:FixedFluidInvSets the fluid in the given tank to the given fluid.- Specified by:
- setInvFluidin interface- FixedFluidInv
- Returns:
- True if the modification was allowed, false otherwise. (For example if the given stack doesn't pass the
         FixedFluidInvView.isFluidValidForTank(int, FluidKey)test).
 
 
-