Package org.spongepowered.api.fluid
Interface FluidStack.Builder
-
- All Superinterfaces:
AbstractBuilder<FluidStack>
,Buildable.Builder<FluidStack>
,Builder<FluidStack,FluidStack.Builder>
,CopyableBuilder<FluidStack,FluidStack.Builder>
,DataBuilder<FluidStack>
,DataHolderBuilder<FluidStack,FluidStack.Builder>
,DataHolderBuilder.Mutable<FluidStack,FluidStack.Builder>
,ResettableBuilder<FluidStack,FluidStack.Builder>
,SerializableDataHolderBuilder<FluidStack,FluidStack.Builder>
,SerializableDataHolderBuilder.Mutable<FluidStack,FluidStack.Builder>
- Enclosing interface:
- FluidStack
public static interface FluidStack.Builder extends SerializableDataHolderBuilder.Mutable<FluidStack,FluidStack.Builder>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.DataHolderBuilder
DataHolderBuilder.Immutable<H extends DataHolder.Immutable<H>,B extends DataHolderBuilder.Immutable<H,B>>, DataHolderBuilder.Mutable<H extends DataHolder.Mutable,B extends DataHolderBuilder.Mutable<H,B>>
-
Nested classes/interfaces inherited from interface org.spongepowered.api.data.SerializableDataHolderBuilder
SerializableDataHolderBuilder.Immutable<H extends SerializableDataHolder.Immutable<H>,B extends SerializableDataHolderBuilder.Immutable<H,B>>, SerializableDataHolderBuilder.Mutable<H extends SerializableDataHolder.Mutable,B extends SerializableDataHolderBuilder.Mutable<H,B>>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description FluidStack
build()
Builds a newFluidStack
based on the desired volume andFluidType
.default FluidStack.Builder
fluid(java.util.function.Supplier<? extends FluidType> fluidType)
Sets theFluidType
to use to build theFluidStack
.FluidStack.Builder
fluid(FluidType fluidType)
Sets theFluidType
to use to build theFluidStack
.FluidStack.Builder
from(FluidStackSnapshot fluidStackSnapshot)
Resets and fills this builder with all the information from the providedFluidStackSnapshot
.FluidStack.Builder
volume(int volume)
Sets the desired volume of theFluidStack
.-
Methods inherited from interface org.spongepowered.api.data.persistence.DataBuilder
build
-
-
-
-
Method Detail
-
fluid
default FluidStack.Builder fluid(java.util.function.Supplier<? extends FluidType> fluidType)
Sets theFluidType
to use to build theFluidStack
.- Parameters:
fluidType
- The fluid type- Returns:
- This builder, for chaining
-
fluid
FluidStack.Builder fluid(FluidType fluidType)
Sets theFluidType
to use to build theFluidStack
.- Parameters:
fluidType
- The fluid type- Returns:
- This builder, for chaining
-
volume
FluidStack.Builder volume(int volume)
Sets the desired volume of theFluidStack
.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- Returns:
- This builder, for chaining
-
build
FluidStack build()
Builds a newFluidStack
based on the desired volume andFluidType
. If either are not set (invalid), anIllegalStateException
may be thrown.- Specified by:
build
in interfaceAbstractBuilder<FluidStack>
- Specified by:
build
in interfaceBuildable.Builder<FluidStack>
- Returns:
- The newly created fluid stack
-
from
FluidStack.Builder from(FluidStackSnapshot fluidStackSnapshot)
Resets and fills this builder with all the information from the providedFluidStackSnapshot
.- Parameters:
fluidStackSnapshot
- The fluid stack snapshot to copy data from- Returns:
- This builder, for chaining
-
-