Package org.spongepowered.api.fluid
Interface FluidStack
- All Superinterfaces:
CopyableDataHolder
,DataHolder
,DataHolder.Mutable
,DataSerializable
,SerializableDataHolder
,SerializableDataHolder.Mutable
,ValueContainer
Represents a stack of a particular
FluidType
and
volume measured in "milliBuckets" where 1000
mB is equal to
1 ItemTypes.BUCKET
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolder
DataHolder.Immutable<I extends DataHolder.Immutable<I>>, DataHolder.Mutable
Nested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolder
SerializableDataHolder.Immutable<I extends SerializableDataHolder.Immutable<I>>, SerializableDataHolder.Mutable
-
Method Summary
Modifier and TypeMethodDescriptionstatic FluidStack.Builder
builder()
Creates a newFluidStack.Builder
to make fluid stacks.copy()
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance.Creates a snapshot of thisFluidStack
.fluid()
Gets theFluidType
for this fluid stack.setVolume
(int volume) Sets the desired volume for this stack.int
volume()
Gets the "volume" of thisFluidStack
.Methods inherited from interface org.spongepowered.api.data.DataHolder.Mutable
copyFrom, copyFrom, offer, offer, offer, offer, offerAll, offerAll, offerAll, offerAll, offerAll, offerAll, offerSingle, offerSingle, offerSingle, offerSingle, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeKey, removeKey, removeSingle, removeSingle, transform, transform, tryOffer, tryOffer, tryOffer, undo
Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializable
contentVersion, toContainer
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder
validateRawData
Methods inherited from interface org.spongepowered.api.data.SerializableDataHolder.Mutable
setRawData
-
Method Details
-
builder
Creates a newFluidStack.Builder
to make fluid stacks.- Returns:
- The newly created builder
-
fluid
FluidType fluid()Gets theFluidType
for this fluid stack.- Returns:
- The fluid type of this stack
-
volume
int volume()Gets the "volume" of thisFluidStack
.Note that the volume is measured in "milli buckets", otherwise read as
mB
. The scaling is as follows: 1 bucket = 1000mB, whereas 1 block usually equals 1000mB.- Returns:
- The volume in milli buckets
-
setVolume
Sets the desired volume for this stack.Note that the volume is measured in "milli buckets", otherwise read as
mB
. The scaling is as follows: 1 bucket = 1000mB, whereas 1 block usually equals 1000mB.- Parameters:
volume
- The volume to set- Returns:
- This fluid stack
-
createSnapshot
FluidStackSnapshot createSnapshot()Creates a snapshot of thisFluidStack
.- Returns:
- The fluid stack snapshot
-
copy
FluidStack copy()Description copied from interface:CopyableDataHolder
Creates a clone copy of thisCopyableDataHolder
as a newCopyableDataHolder
such that all theValue
s are safely duplicated to the new instance. It is not guaranteed that the returning container is of the same type as this container.- Specified by:
copy
in interfaceCopyableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder
- Specified by:
copy
in interfaceSerializableDataHolder.Mutable
- Returns:
- The new copy
-