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