Package alexiil.mc.lib.attributes.fluid
Class FluidVolumeUtil
java.lang.Object
alexiil.mc.lib.attributes.fluid.FluidVolumeUtil
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
static enum
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncomputeExtraction
(FluidVolume inTank, FluidFilter filter, FluidAmount maxAmount) Computes the result ofextractSingle(FixedFluidInv, int, FluidFilter, FluidVolume, FluidAmount, Simulation)
, but without actually modifying an inventory.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.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, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced by the item-based attributes system.static FluidInsertable
createItemInventoryInsertable
(Ref<net.minecraft.item.ItemStack> stackRef, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.static FluidVolume
extractSingle
(FixedFluidInv inv, int tank, FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.static FluidVolume
insertSingle
(FixedFluidInv inv, int tank, FluidVolume toInsert, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.As this has been moved toFixedFluidInv.insertFluid(int, FluidVolume, Simulation)
static boolean
interactCursorWithTank
(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidTransferable, ServerPlayerEntity)
interactWithTank
(FixedFluidInv inv, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced byFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
.interactWithTank
(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FixedFluidInv, PlayerEntity, Hand)
interactWithTank
(FluidInsertable invInsert, FluidExtractable invExtract, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced byFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
.interactWithTank
(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand)
interactWithTank
(FluidTransferable inv, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced byFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
.interactWithTank
(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.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
-
EMPTY
-
-
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
Attempts to move as much fluid as possible from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
-
move
@Deprecated(since="0.6.0", forRemoval=true) public static FluidVolume move(FluidExtractable from, FluidInsertable to, int maximum) Deprecated, for removal: This API element is subject to removal in a future version.Attempts to move up to the given amount of fluid from theFluidExtractable
to theFluidInsertable
.- Returns:
- A copy of the fluid moved.
- See Also:
-
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
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
@Deprecated(since="0.6.0", forRemoval=true) public static FluidVolume move(FluidExtractable from, FluidInsertable to, FluidFilter filter, int maximum) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.5.0", forRemoval=true) public static FluidInsertable createItemInventoryInsertable(Ref<net.minecraft.item.ItemStack> stackRef, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.6.4", forRemoval=true) public static FluidExtractable createItemInventoryExtractable(Ref<net.minecraft.item.ItemStack> stackRef, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.6.4", forRemoval=true) public static boolean interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FixedFluidInv, PlayerEntity, Hand)
-
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidTransferable, PlayerEntity, Hand)
-
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand)
-
interactCursorWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FixedFluidInv, ServerPlayerEntity)
-
interactCursorWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidTransferable, ServerPlayerEntity)
-
interactCursorWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity)
-
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static boolean interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> mainStackRef) Deprecated, for removal: This API element is subject to removal in a future version.The boolean return has been deprecated, and the main method has been moved toFluidInvUtil.interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference)
-
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced byFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
. -
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.This has been replaced byFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
. -
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Ref<net.minecraft.item.ItemStack> stack, Consumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.UseFluidInvUtil.interactItemWithTank(FixedFluidInv, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.UseFluidInvUtil.interactItemWithTank(FluidTransferable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
interactWithTank
@Deprecated(since="0.6.4", forRemoval=true) public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks) Deprecated, for removal: This API element is subject to removal in a future version.UseFluidInvUtil.interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer)
instead: all interactWithTank methods have been moved toFluidInvUtil
. -
insertSingle
@Deprecated(since="0.8.0", forRemoval=true) public static FluidVolume insertSingle(FixedFluidInv inv, int tank, FluidVolume toInsert, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.6.0", forRemoval=true) public static FluidVolume extractSingle(FixedFluidInv inv, int tank, @Nullable FluidFilter filter, FluidVolume toAddWith, int maxAmount, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.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(since="0.8.0", forRemoval=true) public static FluidVolume extractSingle(FixedFluidInv inv, int tank, @Nullable FluidFilter filter, FluidVolume toAddWith, FluidAmount maxAmount, Simulation simulation) Deprecated, for removal: This API element is subject to removal in a future version.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.
-