Class SimpleFixedFluidInv
- All Implemented Interfaces:
- Convertible,- FixedFluidInv,- FixedFluidInvView,- FluidExtractable,- FluidInsertable,- FluidTransferable,- LimitedConsumer<FluidVolume>,- Saveable
- Direct Known Subclasses:
- JumboFixedFluidInv
FixedFluidInv
 exposes.
 
 Extending classes should take care to override getFilterForTank(int) if they also override
 isFluidValidForTank(int, FluidKey).
 
 Note: Generally it is better to extend JumboFixedFluidInv for inventories with a large number of similar
 tanks (like a chest).
- 
Field SummaryFieldsModifier and TypeFieldDescriptionintDeprecated, for removal: This API element is subject to removal in a future version.protected net.minecraft.util.collection.DefaultedList<FluidVolume>
- 
Constructor SummaryConstructorsConstructorDescriptionSimpleFixedFluidInv(int invSize, int tankCapacity)Deprecated, for removal: This API element is subject to removal in a future version.Replaced bySimpleFixedFluidInv(int, FluidAmount).SimpleFixedFluidInv(int invSize, FluidAmount tankCapacity)
- 
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.attemptAnyExtraction(FluidAmount maxAmount, Simulation simulation)attemptExtraction(FluidFilter filter, FluidAmount maxAmount, Simulation simulation)attemptInsertion(FluidVolume fluid, Simulation simulation)Inserts the given stack into this insertable, and returns the excess.protected voidfireTankChange(int tank, FluidVolume previous, FluidVolume current)voidfromTag(net.minecraft.nbt.NbtCompound tag)getFilterForTank(int tank)ExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)as a (potentially) readable filter.Returns anFluidFilterto determine ifFluidInsertable.attemptInsertion(FluidVolume, Simulation)could ever accept a fluid.getInvFluid(int tank)intgetMaxAmount(int tank)Deprecated, for removal: This API element is subject to removal in a future version.Replaced bygetMaxAmount_F(int).getMaxAmount_F(int tank)intvoidbooleanisFluidValidForTank(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.voidsetOwnerListener(FluidInvTankChangeListener ownerListener)Sets the owner listener callback, which is never removed from the listener list wheninvalidateListeners()is called.net.minecraft.nbt.NbtCompoundtoTag()net.minecraft.nbt.NbtCompoundtoTag(net.minecraft.nbt.NbtCompound tag)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, getInsertable, getMappedInv, getSubInv, getTank, getTransferable, insertFluid, modifyTank, tankIterableMethods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInvViewconvertTo, fluidIterable, getFixedView, offerSelfAsAttributeMethods inherited from interface alexiil.mc.lib.attributes.fluid.FluidExtractableattemptAnyExtraction, attemptExtraction, couldExtractAnything, extract, extract, extract, extract, extract, extract, getPureExtractableMethods inherited from interface alexiil.mc.lib.attributes.fluid.FluidInsertablegetPureInsertable, insert, offer, offer, wouldAcceptMethods inherited from interface alexiil.mc.lib.attributes.fluid.FluidTransferablefiltered
- 
Field Details- 
tankCapacityDeprecated, for removal: This API element is subject to removal in a future version.Replaced bytankCapacity_F
- 
tankCapacity_F
- 
tanks
 
- 
- 
Constructor Details- 
SimpleFixedFluidInv@Deprecated(since="0.6.0", forRemoval=true) public SimpleFixedFluidInv(int invSize, int tankCapacity)Deprecated, for removal: This API element is subject to removal in a future version.Replaced bySimpleFixedFluidInv(int, FluidAmount).
- 
SimpleFixedFluidInv
 
- 
- 
Method Details- 
getTankCountpublic final int getTankCount()- Specified by:
- getTankCountin interface- FixedFluidInvView
- Returns:
- The number of tanks in this inventory.
 
- 
getMaxAmountDeprecated, for removal: This API element is subject to removal in a future version.Replaced bygetMaxAmount_F(int).- 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).
 
- 
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!
 
- 
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).
 
- 
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).
 
- 
getGroupedInv- Specified by:
- getGroupedInvin interface- FixedFluidInv
- Specified by:
- getGroupedInvin interface- FixedFluidInvView
- Returns:
- A statistical view of this inventory.
 
- 
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.
 
- 
setOwnerListenerSets the owner listener callback, which is never removed from the listener list wheninvalidateListeners()is called.
- 
invalidateListenerspublic void invalidateListeners()
- 
fireTankChange
- 
toTagpublic final net.minecraft.nbt.NbtCompound toTag()
- 
toTagpublic net.minecraft.nbt.NbtCompound toTag(net.minecraft.nbt.NbtCompound tag)
- 
fromTagpublic void fromTag(net.minecraft.nbt.NbtCompound tag)
- 
attemptInsertionDescription copied from interface:FluidInsertableInserts the given stack into this insertable, and returns the excess.- Specified by:
- attemptInsertionin interface- FluidInsertable
- Parameters:
- fluid- The incoming fluid. Must not be modified by this call.
- simulation- If- Simulation.SIMULATEthen this shouldn't modify anything.
- Returns:
- the excess FluidVolumethat wasn't accepted. This will be independent of this insertable, however it might be the given object instead of a completely new object.
 
- 
getMinimumAcceptedAmount- Specified by:
- getMinimumAcceptedAmountin interface- FluidInsertable
- Returns:
- The minimum amount of fluid that FluidInsertable.attemptInsertion(FluidVolume, Simulation)will actually accept. Note that this only provides a guarantee thatfluid volumeswith anamountless than this will never be accepted.A null return value indicates that there is no minimum value. 
 
- 
getInsertionFilterDescription copied from interface:FluidInsertableReturns anFluidFilterto determine ifFluidInsertable.attemptInsertion(FluidVolume, Simulation)could ever accept a fluid. The default implementation is to returnConstantFluidFilter.ANYTHING, and so it is recommended that custom insertables override this to return a more accurate filter.- Specified by:
- getInsertionFilterin interface- FluidInsertable
- Returns:
- A filter to determine if the given fluid could ever be inserted.
 
- 
attemptExtractionpublic FluidVolume attemptExtraction(FluidFilter filter, FluidAmount maxAmount, Simulation simulation)Description copied from interface:FluidExtractable- Specified by:
- attemptExtractionin interface- FluidExtractable
- maxAmount- The maximum amount of fluid that can be extracted. Negative numbers throw an exception.
- simulation- If- Simulation.SIMULATEthen this should return the same result that the exact same call with- Simulation.ACTIONwould do, except that the filter can be made more specific between calls if the previously simulated extracted fluid is used as a filter.- For example the following code snippet should never throw an exception: - FluidExtractablefrom = // Some extractable
 - FluidVolumeattempted = from.- attemptAnyExtraction(- Integer.MAX_VALUE,- Simulation.SIMULATE);
 if (attempted.- isEmpty()) return;
 - FluidVolumeextracted = from.- extract(attempted.- getFluidKey(), attempted.- getAmount());
 assert !extracted.- isEmpty;
 assert attempted.- getAmount()== extracted.- getAmount();
 assert attempted.- getFluidKet()== extracted.- getFluidKet();
 assert attempted.- equals(extracted);
- Returns:
- A new, independent FluidVolumethat was extracted.
 
- 
attemptAnyExtractionDescription copied from interface:FluidExtractable- Specified by:
- attemptAnyExtractionin interface- FluidExtractable
 
 
- 
tankCapacity_F