Enum EmptyFixedFluidInv
java.lang.Object
java.lang.Enum<EmptyFixedFluidInv>
alexiil.mc.lib.attributes.fluid.impl.EmptyFixedFluidInv
- All Implemented Interfaces:
Convertible
,FixedFluidInv
,FixedFluidInvView
,NullVariant
,java.io.Serializable
,java.lang.Comparable<EmptyFixedFluidInv>
,java.lang.constant.Constable
public enum EmptyFixedFluidInv extends java.lang.Enum<EmptyFixedFluidInv> implements FixedFluidInv, NullVariant
An
FixedFluidInv
with no tanks. Because this inventory is unmodifiable this also doubles as the empty
implementation for FixedFluidInvView
.-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
Modifier and Type Method Description ListenerToken
addListener(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.FluidExtractable
getExtractable()
FluidFilter
getFilterForTank(int tank)
ExposesFixedFluidInvView.isFluidValidForTank(int, FluidKey)
as a (potentially) readable filter.FixedFluidInvView
getFixedView()
GroupedFluidInv
getGroupedInv()
FluidInsertable
getInsertable()
FluidVolume
getInvFluid(int tank)
int
getMaxAmount(int tank)
int
getTankCount()
FluidTransferable
getTransferable()
boolean
isFluidValidForTank(int tank, FluidKey item)
Checks to see if the given fluid would be valid for this tank, ignoring current contents.boolean
setInvFluid(int tank, FluidVolume to, Simulation simulation)
Sets the fluid in the given tank to the given fluid.java.lang.String
toString()
static EmptyFixedFluidInv
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static EmptyFixedFluidInv[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
Methods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInv
createLimitedFixedInv, extractFluid, forceSetInvFluid, getMappedInv, getSubInv, getTank, insertFluid, modifyTank, tankIterable
Methods inherited from interface alexiil.mc.lib.attributes.fluid.FixedFluidInvView
convertTo, fluidIterable, getMaxAmount_F, offerSelfAsAttribute
-
Enum Constant Details
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getTankCount
public int getTankCount()- Specified by:
getTankCount
in interfaceFixedFluidInvView
- Returns:
- The number of tanks in this inventory.
-
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:FixedFluidInv
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.Note that just because an
FluidKey
passes this validity test, and is mergable with the current fluid, does not mean that you can insert the fluid into this inventory.- Specified by:
isFluidValidForTank
in interfaceFixedFluidInv
- 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
public int getMaxAmount(int tank)- 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).
-
addListener
public ListenerToken addListener(FluidInvTankChangeListener listener, ListenerRemovalToken removalToken)Description copied from interface:FixedFluidInvView
Adds 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:
addListener
in interfaceFixedFluidInvView
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.
-
setInvFluid
Description copied from interface:FixedFluidInv
Sets the fluid in the given tank to the given fluid.- Specified by:
setInvFluid
in interfaceFixedFluidInv
- Returns:
- True if the modification was allowed, false otherwise. (For example if the given stack doesn't pass the
FixedFluidInvView.isFluidValidForTank(int, FluidKey)
test).
-
getFixedView
- Specified by:
getFixedView
in interfaceFixedFluidInvView
- Returns:
- An object that only implements
FixedFluidInvView
, and does not expose the modification methods thatFixedFluidInv
does. Implementations that don't expose any modification methods themselves should override this method to just return themselves.
-
getGroupedInv
- Specified by:
getGroupedInv
in interfaceFixedFluidInv
- Specified by:
getGroupedInv
in interfaceFixedFluidInvView
- Returns:
- A statistical view of this inventory.
-
getTransferable
- Specified by:
getTransferable
in interfaceFixedFluidInv
- Returns:
- An
FluidTransferable
for this inventory that will attempt to extract from any of the tanks in this inventory.
-
getInsertable
- Specified by:
getInsertable
in interfaceFixedFluidInv
- Returns:
- An
FluidInsertable
for this inventory that will attempt to insert into any of the tanks in this inventory.
-
getExtractable
- Specified by:
getExtractable
in interfaceFixedFluidInv
- Returns:
- An
FluidExtractable
for this inventory that will attempt to extract from any of the tanks in this inventory.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Enum<EmptyFixedFluidInv>
-