Package alexiil.mc.lib.attributes.fluid
Class FluidVolumeUtil
java.lang.Object
alexiil.mc.lib.attributes.fluid.FluidVolumeUtil
public final class FluidVolumeUtil
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FluidVolumeUtil.FluidTankInteraction
static class
FluidVolumeUtil.FluidTransferResult
static class
FluidVolumeUtil.ItemContainerStatus
-
Field Summary
Fields Modifier and Type Field Description static FluidVolume
EMPTY
-
Method Summary
Modifier and Type Method Description static FluidVolumeUtil.FluidTransferResult
computeExtraction(FluidVolume inTank, FluidFilter filter, FluidAmount maxAmount)
Computes the result ofextractSingle(FixedFluidInv, int, FluidFilter, FluidVolume, FluidAmount, Simulation)
, but without actually modifying an inventory.static FluidVolumeUtil.FluidTransferResult
computeExtraction(FluidVolume inTank, FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount)
Computes the result ofextractSingle(FixedFluidInv, int, FluidFilter, FluidVolume, FluidAmount, Simulation)
, but without actually modifying an inventory.static FluidVolumeUtil.FluidTransferResult
computeInsertion(FluidVolume current, FluidAmount capacity, FluidVolume toInsert)
Computes the result ofinsertSingle(FixedFluidInv, int, FluidVolume, Simulation)
, but without actually modifying an inventory.static FluidExtractable
createItemInventoryExtractable(Ref<net.minecraft.item.ItemStack> stackRef, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.This has been replaced by the item-based attributes system.static FluidInsertable
createItemInventoryInsertable(Ref<net.minecraft.item.ItemStack> stackRef, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.This has been replaced by the item-based attributes system.static FluidVolume
extractSingle(FixedFluidInv inv, int tank, FluidFilter filter, FluidVolume toAddWith, int maxAmount, Simulation simulation)
Deprecated.static FluidVolume
extractSingle(FixedFluidInv inv, int tank, FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount, Simulation simulation)
Deprecated.static FluidVolume
insertSingle(FixedFluidInv inv, int tank, FluidVolume toInsert, Simulation simulation)
Deprecated.As this has been moved toFixedFluidInv.insertFluid(int, FluidVolume, Simulation)
static boolean
interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FixedFluidInv, ServerPlayerEntity)
static boolean
interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity)
static boolean
interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidTransferable, ServerPlayerEntity)
static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.UseFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
.static boolean
interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FixedFluidInv, PlayerEntity, Hand)
static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.UseFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
.static boolean
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> mainStackRef)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference)
static boolean
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand)
static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
Deprecated.UseFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
.static boolean
interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidTransferable, PlayerEntity, Hand)
static FluidVolume
move(FluidExtractable from, FluidInsertable to)
Attempts to move as much fluid as possible from theFluidExtractable
to theFluidInsertable
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, int maximum)
Deprecated.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidAmount maximum)
Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidAmount maximum, Simulation simulation)
Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidFilter filter)
Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidFilter filter, int maximum)
Deprecated.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidFilter filter, FluidAmount maximum)
Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidFilter filter, FluidAmount maximum, Simulation simulation)
Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, FluidFilter filter, Simulation simulation)
Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.static FluidVolume
move(FluidExtractable from, FluidInsertable to, Simulation simulation)
Attempts to move as much fluid as possible from theFluidExtractable
to theFluidInsertable
.
-
Field Details
-
Method Details
-
move
Attempts to move as much fluid as possible from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
move(FluidExtractable, FluidInsertable, FluidFilter, int)
-
move
Attempts to move as much fluid as possible from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
move(FluidExtractable, FluidInsertable, FluidFilter, int)
-
move
Deprecated.Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
move(FluidExtractable, FluidInsertable, FluidFilter, int)
-
move
Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
move(FluidExtractable, FluidInsertable, FluidFilter, int)
-
move
public static FluidVolume move(FluidExtractable from, FluidInsertable to, FluidAmount maximum, Simulation simulation)Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
move(FluidExtractable, FluidInsertable, FluidFilter, int)
-
move
@Deprecated public static FluidVolume move(FluidExtractable from, FluidInsertable to, FluidFilter filter, int maximum)Deprecated.Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.- Returns:
- A copy of the fluid moved.
-
move
Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.- Returns:
- A copy of the fluid moved.
-
move
public static FluidVolume move(FluidExtractable from, FluidInsertable to, FluidFilter filter, Simulation simulation)Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.- Returns:
- A copy of the fluid moved.
-
move
public static FluidVolume move(FluidExtractable from, FluidInsertable to, @Nullable FluidFilter filter, @Nullable FluidAmount maximum)Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.- Returns:
- A copy of the fluid moved.
-
move
public static FluidVolume move(FluidExtractable from, FluidInsertable to, @Nullable FluidFilter filter, @Nullable FluidAmount maximum, Simulation simulation)Attempts to move up to the given maximum amount of fluids from theFluidExtractable
to theFluidInsertable
, provided they match the givenFluidFilter
.- Returns:
- A copy of the fluid moved.
-
createItemInventoryInsertable
@Deprecated public static FluidInsertable createItemInventoryInsertable(Ref<net.minecraft.item.ItemStack> stackRef, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.This has been replaced by the item-based attributes system.- Returns:
- An
FluidInsertable
that will insert fluids into the given stack (overflowing into the givenConsumer
)
-
createItemInventoryExtractable
@Deprecated public static FluidExtractable createItemInventoryExtractable(Ref<net.minecraft.item.ItemStack> stackRef, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.This has been replaced by the item-based attributes system.- Returns:
- An
FluidExtractable
that will extract fluids from the given stack (overflowing into the givenConsumer
)
-
interactWithTank
@Deprecated public static boolean interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FixedFluidInv, PlayerEntity, Hand)
-
interactWithTank
@Deprecated public static boolean interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidTransferable, PlayerEntity, Hand)
-
interactWithTank
@Deprecated public static boolean interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand)
-
interactCursorWithTank
@Deprecated public static boolean interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FixedFluidInv, ServerPlayerEntity)
-
interactCursorWithTank
@Deprecated public static boolean interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidTransferable, ServerPlayerEntity)
-
interactCursorWithTank
@Deprecated public static boolean interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity)
-
interactWithTank
@Deprecated public static boolean interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> mainStackRef)Deprecated.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference)
-
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
. -
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
. -
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Ref<net.minecraft.item.ItemStack> stack, java.util.function.Consumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.This has been replaced byFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
.- Parameters:
invInsert
- The fluid inventory to interact withinvExtract
- The fluid inventory to interact withstack
- The heldItemStack
to interact with.excessStacks
- AConsumer
to take the excessItemStack
's.
-
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.UseFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.UseFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
interactWithTank
@Deprecated public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)Deprecated.UseFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
insertSingle
@Deprecated public static FluidVolume insertSingle(FixedFluidInv inv, int tank, FluidVolume toInsert, Simulation simulation)Deprecated.As this has been moved toFixedFluidInv.insertFluid(int, FluidVolume, Simulation)
Inserts a singleFluidVolume
into aFixedFluidInv
, using onlyFixedFluidInv.setInvFluid(int, FluidVolume, Simulation)
. As such this is useful for implementations ofFluidInsertable
(or others) for their base implementation.- Parameters:
toInsert
- The volume to insert. This will not be modified.- Returns:
- The excess
FluidVolume
that wasn't inserted.
-
computeInsertion
public static FluidVolumeUtil.FluidTransferResult computeInsertion(FluidVolume current, FluidAmount capacity, FluidVolume toInsert)Computes the result ofinsertSingle(FixedFluidInv, int, FluidVolume, Simulation)
, but without actually modifying an inventory.- Returns:
- The result of this insertion. If the insertion failed then the fields will be identical (==) to their
respective
FluidVolume
s passed in.
-
extractSingle
@Deprecated public static FluidVolume extractSingle(FixedFluidInv inv, int tank, @Nullable FluidFilter filter, FluidVolume toAddWith, int maxAmount, Simulation simulation)Deprecated.Extracts a singleFluidVolume
from aFixedFluidInv
, using onlyFixedFluidInv.setInvFluid(int, FluidVolume, Simulation)
. As such this is useful for implementations ofFluidExtractable
(or others) for their base implementations.- Parameters:
filter
- The filter to match on. If this is null then it matches on anything.toAddWith
- An optionalFluidVolume
that the extracted fluid will be added to. Null is equivalent toempty
.maxAmount
- The maximum amount of fluid to extract. Note that the returnedFluidVolume
may have an amount up to this given amount plus the amount in "toAddWith".- Returns:
- The extracted
FluidVolume
, inTank with "toAddWith".
-
extractSingle
@Deprecated public static FluidVolume extractSingle(FixedFluidInv inv, int tank, @Nullable FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount, Simulation simulation)Deprecated.Extracts a singleFluidVolume
from aFixedFluidInv
, using onlyFixedFluidInv.setInvFluid(int, FluidVolume, Simulation)
. As such this is useful for implementations ofFluidExtractable
(or others) for their base implementations.- Parameters:
filter
- The filter to match on. If this is null then it matches on anything.toAddWith
- An optionalFluidVolume
that the extracted fluid will be added to. Null is equivalent toempty
.maxAmount
- The maximum amount of fluid to extract. Note that the returnedFluidVolume
may have an amount up to this given amount plus the amount in "toAddWith".- Returns:
- The extracted
FluidVolume
, inTank with "toAddWith".
-
computeExtraction
public static FluidVolumeUtil.FluidTransferResult computeExtraction(FluidVolume inTank, FluidFilter filter, FluidAmount maxAmount)Computes the result ofextractSingle(FixedFluidInv, int, FluidFilter, FluidVolume, FluidAmount, Simulation)
, but without actually modifying an inventory.- Returns:
- The result of this extraction. If the extraction failed then
FluidVolumeUtil.FluidTransferResult.inTank
will be identical (==) to the passed inFluidVolume
.
-
computeExtraction
public static FluidVolumeUtil.FluidTransferResult computeExtraction(FluidVolume inTank, FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount)Computes the result ofextractSingle(FixedFluidInv, int, FluidFilter, FluidVolume, FluidAmount, Simulation)
, but without actually modifying an inventory.- Returns:
- The result of this extraction. If the insertion extraction then the fields will be identical (==) to
their respective
FluidVolume
s passed in.
-