Interface FluidContainer
- All Superinterfaces:
net.minecraft.world.Clearable,Serializable
- All Known Subinterfaces:
ItemFluidContainer
- All Known Implementing Classes:
ExtractOnlyFluidContainer,InsertOnlyFluidContainer,PlatformBlockFluidHandler,PlatformFluidItemHandler,SimpleFluidContainer,UnlimitedFluidContainer,WrappedBlockFluidContainer,WrappedItemFluidContainer
-
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancopy()extractFluid(FluidHolder fluid, boolean simulate) Extracts aFluidHolderfrom the container.longextractFromSlot(FluidHolder fluidHolder, FluidHolder toInsert, Runnable snapshot) Extracts a fluid from oneFluidHolderinto another.voidfromContainer(FluidContainer container) Sets the container to the same values as the given container.intgetSize()longgetTankCapacity(int tankSlot) static booleanholdsFluid(net.minecraft.world.item.ItemStack stack) static booleanholdsFluid(net.minecraft.world.level.block.entity.BlockEntity block, @Nullable net.minecraft.core.Direction direction) static booleanholdsFluid(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable net.minecraft.core.Direction direction) longinsertFluid(FluidHolder fluid, boolean simulate) Inserts aFluidHolderinto the container.default FluidHolderinternalExtract(FluidHolder fluid, boolean simulate) An internal version ofextractFluid(FluidHolder, boolean)that is used by mod authors looking to directly interact with their own containers.default longinternalInsert(FluidHolder fluids, boolean simulate) An internal version ofinsertFluid(FluidHolder, boolean)that is used by mod authors looking to directly interact with their own containers.booleanisEmpty()default booleanisFluidValid(int slot, FluidHolder fluidHolder) static @Nullable FluidContainerof(ItemStackHolder holder) static @Nullable FluidContainerof(net.minecraft.world.level.block.entity.BlockEntity block, @Nullable net.minecraft.core.Direction direction) static @Nullable FluidContainerof(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable net.minecraft.core.Direction direction) default voidreadSnapshot(FluidSnapshot snapshot) Sets theFluidContainerwith the given state ofFluidSnapshot.voidsetFluid(int slot, FluidHolder fluid) Sets a givenFluidHolderto a slot in the container.Methods inherited from interface net.minecraft.world.Clearable
clearContentMethods inherited from interface earth.terrarium.botarium.util.Serializable
deserialize, serialize
-
Method Details
-
of
@Nullable @ImplementedByExtension static @Nullable FluidContainer of(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable @Nullable net.minecraft.core.Direction direction) -
of
@Nullable static @Nullable FluidContainer of(net.minecraft.world.level.block.entity.BlockEntity block, @Nullable @Nullable net.minecraft.core.Direction direction) -
of
-
holdsFluid
@ImplementedByExtension static boolean holdsFluid(net.minecraft.world.item.ItemStack stack) -
holdsFluid
@ImplementedByExtension static boolean holdsFluid(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable @Nullable net.minecraft.core.Direction direction) -
holdsFluid
static boolean holdsFluid(net.minecraft.world.level.block.entity.BlockEntity block, @Nullable @Nullable net.minecraft.core.Direction direction) -
insertFluid
Inserts aFluidHolderinto the container.- Parameters:
fluid- TheFluidHolderto be inserted into the container.simulate- If true, the container will not be modified.- Returns:
- The amount of fluid that was added to the container.
-
internalInsert
An internal version ofinsertFluid(FluidHolder, boolean)that is used by mod authors looking to directly interact with their own containers.You should not call this method for other mod's containers, instead use
insertFluid(FluidHolder, boolean). -
extractFluid
Extracts aFluidHolderfrom the container.- Parameters:
fluid- TheFluidHolderto be extracted from the container.simulate- If true, the container will not be modified.- Returns:
- The
FluidHolderthat was extracted from the container.
-
internalExtract
An internal version ofextractFluid(FluidHolder, boolean)that is used by mod authors looking to directly interact with their own containers.You should not call this method for other mod's containers, instead use
extractFluid(FluidHolder, boolean). -
setFluid
Sets a givenFluidHolderto a slot in the container.- Parameters:
slot- The slot to set the fluid in.fluid- TheFluidHolderto set in the slot.
-
getFluids
List<FluidHolder> getFluids()- Returns:
- A
ListofFluidHolderin the container.
-
getSize
int getSize()- Returns:
- The amount of slots in the container.
-
isEmpty
boolean isEmpty()- Returns:
- Weather or not the container is empty.
-
copy
FluidContainer copy()- Returns:
- A copy of the container.
-
getTankCapacity
long getTankCapacity(int tankSlot) - Parameters:
tankSlot- The slot to get the capacity of.- Returns:
- The capacity of the given slot.
-
fromContainer
Sets the container to the same values as the given container.- Parameters:
container- The container to copy the fluids from.
-
extractFromSlot
Extracts a fluid from oneFluidHolderinto another.- Parameters:
fluidHolder- TheFluidHolderto extract from.toInsert- TheFluidHolderto insert into. With amount clamped between 0-fluid.getFluidAmount().snapshot- A runnable that will be called before the extraction happens.- Returns:
- The amount of fluid that was extracted.
-
allowsInsertion
boolean allowsInsertion()- Returns:
- Weather can be inserted into.
-
allowsExtraction
boolean allowsExtraction()- Returns:
- Weather can be extracted from.
-
isFluidValid
- Parameters:
fluidHolder- TheFluidHolderto check if can be inserted into.- Returns:
- Weather the given
FluidHoldercan be inserted into.
-
createSnapshot
FluidSnapshot createSnapshot()- Returns:
- A
FluidSnapshotof the given state of theFluidContainer.
-
readSnapshot
Sets theFluidContainerwith the given state ofFluidSnapshot.- Parameters:
snapshot- TheFluidSnapshotto set theFluidContainerto.
-