Class FluidInvUtil
public final class FluidInvUtil
extends java.lang.Object
Reference
of an ItemStack
with a FixedFluidInv
,
FluidTransferable
, or FluidInsertable
&FluidExtractable
pair.
The 4 main methods are:
interactItemWithTank(...)
: which is the base method for interacting anything with a tank (and doesn't do anything special)interactWithTank(...)
: Which uses interactItemWithTank internally, but adds excess items to the player's inventory as well as playing a sound.interactHandWithTank(...)
: Which uses interactWithTank internally, and interacts with the player's current held item. (This is the first method that doesn't require the caller to create aReference
themselves).interactCursorWithTank(...)
: Which uses interactWithTank internally, and interacts with the player's cursor stack (what the player has while they have aHandledScreen
open). (This is the second method that doesn't require the caller to create aReference
themselves).
-
Method Summary
Modifier and Type Method Description static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player)
This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)
This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)
This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)
This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player)
This is the "interactCursorWithTank" variant that doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)
This is the "interactCursorWithTank" variant that doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)
This is the "interactCursorWithTank" variant that doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)
Attempts to either fill the insertable from the player'sPlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player)
This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)
This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)
This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)
This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)
This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)
This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)
This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
This is the "interactHandWithTank" variant that doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)
This is the "interactHandWithTank" variant that doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)
This is the "interactHandWithTank" variant that doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)
Attempts to either fill the insertable from the player'shand
, or drain the extractable to the hand.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved, or how much fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)
This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)
This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit the maximum amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)
This is the "interactHandWithTank" variant that takes a singleFluidTransferable
.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit the fluid moved, or the amount moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)
This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)
This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)
This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
This is the "interactItemWithTank" variant that doesn't limit what fluid is moved, or the amount of fluid that is moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)
This is the "interactItemWithTank" variant that doesn't filter what is moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)
This is the "interactItemWithTank" variant that doesn't limit the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidInsertable invInsert, FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)
Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)
This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't limit what fluid is moved, or how much is moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)
This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't filter what is moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)
This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't limit the amount moved.static FluidVolumeUtil.FluidTankInteraction
interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)
This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)
This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit what fluid is moved, or the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)
This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)
This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)
This is the "interactWithTank" variant that takes a singleFixedFluidInv
.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)
This is the "interactWithTank" variant that doesn't limit what fluid is moved, or the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)
This is the "interactWithTank" variant that doesn't limit the fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)
This is the "interactWithTank" variant that doesn't limit the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidInsertable invInsert, FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)
Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)
This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit what fluid is moved, or the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)
This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit what fluid is moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)
This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit the amount of fluid moved.static FluidVolumeUtil.FluidTankInteraction
interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)
This is the "interactWithTank" variant that takes a singleFluidTransferable
.
-
Method Details
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the inventory from the player's
hand
, or drain the inventory to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved.Attempts to either fill the inventory from the player's
hand
, or drain the inventory to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
and doesn't limit the maximum amount of fluid moved.Attempts to either fill the inventory from the player's
hand
, or drain the inventory to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)This is the "interactHandWithTank" variant that takes a singleFixedFluidInv
.Attempts to either fill the inventory from the player's
hand
, or drain the inventory to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the transferable from the player's
hand
, or drain the transferable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved.Attempts to either fill the transferable from the player's
hand
, or drain the transferable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)This is the "interactHandWithTank" variant that takes a singleFluidTransferable
and doesn't limit the maximum amount of fluid moved.Attempts to either fill the transferable from the player's
hand
, or drain the transferable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)This is the "interactHandWithTank" variant that takes a singleFluidTransferable
.Attempts to either fill the transferable from the player's
hand
, or drain the transferable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)This is the "interactHandWithTank" variant that doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the insertable from the player's
hand
, or drain the extractable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidAmount maximum)This is the "interactHandWithTank" variant that doesn't limit what fluid is moved.Attempts to either fill the insertable from the player's
hand
, or drain the extractable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter)This is the "interactHandWithTank" variant that doesn't limit the maximum amount of fluid moved.Attempts to either fill the insertable from the player's
hand
, or drain the extractable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactHandWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Hand, FluidFilter, FluidAmount)
-
interactHandWithTank
public static FluidVolumeUtil.FluidTankInteraction interactHandWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand, FluidFilter filter, FluidAmount maximum)Attempts to either fill the insertable from the player'shand
, or drain the extractable to the hand. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player)This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the inventory from the player's
PlayerInventory.getCursorStack()
, or drain the inventory to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit what fluid is moved.Attempts to either fill the inventory from the player's
PlayerInventory.getCursorStack()
, or drain the inventory to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
and doesn't limit the maximum amount of fluid moved.Attempts to either fill the inventory from the player's
PlayerInventory.getCursorStack()
, or drain the inventory to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity, FluidFilter, FluidAmount)
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FixedFluidInv inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)This is the "interactCursorWithTank" variant that takes a singleFixedFluidInv
.Attempts to either fill the inventory from the player's
PlayerInventory.getCursorStack()
, or drain the inventory to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity, FluidFilter, FluidAmount)
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player)This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit what fluid is moved.Attempts to either fill the transferable from the player's
PlayerInventory.getCursorStack()
, or drain the transferable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
and doesn't limit the maximum amount of fluid moved.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity, FluidFilter, FluidAmount)
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(FluidTransferable inv, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)This is the "interactCursorWithTank" variant that takes a singleFluidTransferable
.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity, FluidFilter, FluidAmount)
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player)This is the "interactCursorWithTank" variant that doesn't limit what fluid is moved, or how much fluid is moved.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidAmount maximum)This is the "interactCursorWithTank" variant that doesn't limit what fluid is moved.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter)This is the "interactCursorWithTank" variant that doesn't limit the maximum amount of fluid moved.Attempts to either fill the insertable from the player's
PlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactCursorWithTank(FluidInsertable, FluidExtractable, ServerPlayerEntity, FluidFilter, FluidAmount)
-
interactCursorWithTank
public static FluidVolumeUtil.FluidTankInteraction interactCursorWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.server.network.ServerPlayerEntity player, FluidFilter filter, FluidAmount maximum)Attempts to either fill the insertable from the player'sPlayerInventory.getCursorStack()
, or drain the extractable to the cursor stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the cursor stack won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit what fluid is moved, or the amount of fluid moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit what fluid is moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)This is the "interactWithTank" variant that takes a singleFixedFluidInv
, and doesn't limit the amount of fluid moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FixedFluidInv inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)This is the "interactWithTank" variant that takes a singleFixedFluidInv
.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit what fluid is moved, or the amount of fluid moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit what fluid is moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)This is the "interactWithTank" variant that takes a singleFluidTransferable
, and doesn't limit the amount of fluid moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(FluidTransferable inv, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)This is the "interactWithTank" variant that takes a singleFluidTransferable
.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack)This is the "interactWithTank" variant that doesn't limit what fluid is moved, or the amount of fluid moved.Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter)This is the "interactWithTank" variant that doesn't limit the amount of fluid moved.Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidAmount maximum)This is the "interactWithTank" variant that doesn't limit the fluid moved.Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactWithTank(FluidInsertable, FluidExtractable, PlayerEntity, Reference, FluidFilter, FluidAmount)
-
interactWithTank
public static FluidVolumeUtil.FluidTankInteraction interactWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, net.minecraft.entity.player.PlayerEntity player, Reference<net.minecraft.item.ItemStack> stack, FluidFilter filter, FluidAmount maximum)Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.Unlike
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
this will:- Play a sound for filling/draining either a bottle or a bucket.
- Add excess items directly to the player's inventory (or voids them if the player is in creative mode)
- If the player is in creative mode then the stack reference given won't be modified.
- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid. (Unless the player is in creative mode).filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit the fluid moved, or the amount moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit the amount of fluid moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks, and doesn't limit what fluid is moved.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FixedFluidInv inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)This is the "interactItemWithTank" variant that uses a singleFixedFluidInv
for the insertable/extractable tanks.Attempts to either fill the inventory from the provided stack reference, or drain the inventory to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid inventory to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't limit what fluid is moved, or how much is moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't limit the amount moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks, and doesn't filter what is moved.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(FluidTransferable inv, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)This is the "interactItemWithTank" variant that uses a singleFluidTransferable
for the insertable/extractable tanks.Attempts to either fill the transferable from the provided stack reference, or drain the transferable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
inv
- The fluid transferable to interact with (referred to as "the tank").stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks)This is the "interactItemWithTank" variant that doesn't limit what fluid is moved, or the amount of fluid that is moved.Attempts to either fill the {inventory/transferable/insertable} from the provided stack reference, or drain the {inventory/transferable/extractable} to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter)This is the "interactItemWithTank" variant that doesn't limit the amount of fluid moved.Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidAmount maximum)This is the "interactItemWithTank" variant that doesn't filter what is moved.Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (
FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods. - See Also:
interactItemWithTank(FluidInsertable, FluidExtractable, Reference, LimitedConsumer, FluidFilter, FluidAmount)
-
interactItemWithTank
public static FluidVolumeUtil.FluidTankInteraction interactItemWithTank(@Nullable FluidInsertable invInsert, @Nullable FluidExtractable invExtract, Reference<net.minecraft.item.ItemStack> stack, LimitedConsumer<net.minecraft.item.ItemStack> excessStacks, FluidFilter filter, FluidAmount maximum)Attempts to either fill the insertable from the provided stack reference, or drain the extractable to the provided stack. Internally this uses (FluidAttributes.INSERTABLE
/FluidAttributes.EXTRACTABLE
).get
(stack, excessStacks) to get theFluidExtractable
/FluidInsertable
from the item to extract from or insert to.For example, you could have a machine that fills it's internal fluid tank from a slot containing
ItemStack
s. If the machine has both an inventory for incoming items that contain fluid and an inventory for outgoing items then this could be called once for each item in the incoming inventory with theReference
being the currentItemStack
to drain from, and theLimitedConsumer
being an inserter (perhaps an ItemInsertable from LBA's item module) to the outgoing inventory. (This does make the assumption that the incoming inventory filters the incoming items to only accept items which can have fluid drained from them).- Parameters:
invInsert
- The fluid insertable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to extract from the item, andFluidVolumeUtil.FluidTankInteraction.fromTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.invExtract
- The fluid extractable to interact with (referred to as "the tank"). If this is null (or implementsNullVariant
) then this will not attempt to insert into the item, andFluidVolumeUtil.FluidTankInteraction.intoTankStatus
will beFluidVolumeUtil.ItemContainerStatus.NOT_CHECKED
.stack
- TheReference
holding anItemStack
to interact with. If the reference doesn't allow modification then this will always fail to move any fluid.excessStacks
- TheLimitedConsumer
to take any excessItemStack
's that can't go back into the provided reference.filter
- A filter to limit whatFluidKey
may be moved.maximum
- The maximum amount of fluid that may be moved.- Returns:
- A
FluidVolumeUtil.FluidTankInteraction
with some information about what happened:FluidVolumeUtil.FluidTankInteraction.fluidMoved
for a copy of the fluid moved.FluidVolumeUtil.FluidTankInteraction.intoTank
will be true if fluid was extracted from the item and inserted into the tank, and false otherwise.FluidVolumeUtil.FluidTankInteraction.intoTankStatus
will have the status of the item'sFluidExtractable
.FluidVolumeUtil.FluidTankInteraction.fromTankStatus
will have the status of the item'sFluidInsertable
.
FluidVolumeUtil.FluidTankInteraction.didMoveAny()
is recommended for checking to see if anything was moved.The method
FluidVolumeUtil.FluidTankInteraction.asActionResult()
is recommended for converting the result into anActionResult
, suitable for normal block or item "use" methods.
-