Class FluidUtils

java.lang.Object
me.desht.pneumaticcraft.common.util.FluidUtils

public class FluidUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isFlowingFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    Check if the given blockpos contains a flowing fluid block of any fluid.
    static boolean
    isFlowingFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.Fluid fluid)
    Check if the given blockpos contains a flowing fluid block of the given fluid type.
    static boolean
    isSourceFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    Check if the given blockpos contains a fluid source block.
    static boolean
    isSourceFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.Fluid fluid)
    Check if the given blockpos contains a fluid source block of a certain fluid (or possibly any fluid)
    static boolean
    matchFluid(FluidIngredient fluidIngredient, net.minecraft.world.level.material.Fluid fluid, boolean matchTags)
     
    static boolean
    matchFluid(FluidIngredient fluidIngredient, net.minecraftforge.fluids.FluidStack fluidStack, boolean matchTags)
     
    static boolean
    tryFluidExtraction(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
    Have the player attempt to extract liquid from a block entity, which must support FLUID_HANDLER_CAPABILITY.
    static boolean
    tryFluidExtraction(net.minecraftforge.fluids.capability.IFluidHandler srcHandler, net.minecraft.world.item.ItemStack destStack, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> returnedItems)
    Attempt to extract fluid from the given fluid handler into the given fluid-containing item.
    static boolean
    tryFluidInsertion(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
    Have the player attempt to insert liquid into a block entity, which must support FLUID_HANDLER_CAPABILITY.
    static boolean
    tryFluidInsertion(net.minecraftforge.fluids.capability.IFluidHandler handler, net.minecraft.world.item.ItemStack srcStack, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> returnedItems)
    Attempt to insert fluid into the given fluid handler from the given fluid container item.
    static net.minecraftforge.fluids.FluidStack
    tryPickupFluid(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> fluidCap, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, boolean playSound, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
    Attempt to pick up 1000mB (one bucket) fluid from the world and stow it in the given fluid handler.
    static boolean
    tryPourOutFluid(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> fluidCap, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, boolean playSound, boolean force, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
    Try to pour 1000mB (one bucket) of fluid into the world at the given position.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FluidUtils

      public FluidUtils()
  • Method Details

    • tryFluidExtraction

      public static boolean tryFluidExtraction(net.minecraftforge.fluids.capability.IFluidHandler srcHandler, net.minecraft.world.item.ItemStack destStack, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> returnedItems)
      Attempt to extract fluid from the given fluid handler into the given fluid-containing item.
      Parameters:
      srcHandler - fluid handler into which to place the fluid
      destStack - the fluid container item to extract from
      returnedItems - the modified fluid container after extraction
      Returns:
      true if any fluid was moved, false otherwise
    • tryFluidInsertion

      public static boolean tryFluidInsertion(net.minecraftforge.fluids.capability.IFluidHandler handler, net.minecraft.world.item.ItemStack srcStack, net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> returnedItems)
      Attempt to insert fluid into the given fluid handler from the given fluid container item.
      Parameters:
      handler - the handler to extract from
      srcStack - the fluid container item to insert to
      returnedItems - the modified fluid container after insertion
      Returns:
      true if any fluid was moved, false otherwise
    • tryFluidInsertion

      public static boolean tryFluidInsertion(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Have the player attempt to insert liquid into a block entity, which must support FLUID_HANDLER_CAPABILITY. The player's held item will be updated if any fluid was inserted.
      Parameters:
      te - the block entity to insert into
      face - the face of the block entity's block to insert to
      player - the player
      hand - the hand being used
      Returns:
      true if any fluid was inserted, false otherwise
    • tryFluidExtraction

      public static boolean tryFluidExtraction(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction face, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Have the player attempt to extract liquid from a block entity, which must support FLUID_HANDLER_CAPABILITY. The player's held item will be updated if any fluid was extracted.
      Parameters:
      te - the block entity to extract from
      face - the face of the block entity's block to extract from
      player - the player
      hand - the hand being used
      Returns:
      true if any fluid was extracted, false otherwise
    • isSourceFluidBlock

      public static boolean isSourceFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Check if the given blockpos contains a fluid source block.
      Parameters:
      world - the world
      pos - the blockpos
      Returns:
      true if there is a fluid source block at the given blockpos, false otherwise
    • isSourceFluidBlock

      public static boolean isSourceFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.material.Fluid fluid)
      Check if the given blockpos contains a fluid source block of a certain fluid (or possibly any fluid)
      Parameters:
      world - the world
      pos - the blockpos
      fluid - the fluid, may be null to match any fluid
      Returns:
      true if there is a fluid source block of the right fluid at the given blockpos, false otherwise
    • isFlowingFluidBlock

      public static boolean isFlowingFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Check if the given blockpos contains a flowing fluid block of any fluid.
      Parameters:
      world - the world
      pos - the blockpos
      Returns:
      true if there is a fluid block at the given blockpos, which is not a source block
    • isFlowingFluidBlock

      public static boolean isFlowingFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.material.Fluid fluid)
      Check if the given blockpos contains a flowing fluid block of the given fluid type.
      Parameters:
      world - the world
      pos - the blockpos
      fluid - the fluid (null to match any fluid)
      Returns:
      true if there is a matching fluid block at the given blockpos, which is not a source block
    • tryPickupFluid

      public static net.minecraftforge.fluids.FluidStack tryPickupFluid(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> fluidCap, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, boolean playSound, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
      Attempt to pick up 1000mB (one bucket) fluid from the world and stow it in the given fluid handler.
      Parameters:
      fluidCap - the fluid capability to insert fluid to
      world - the world
      pos - the block pos to pull fluid from
      playSound - true to play a bucket-fill sound
      action - whether to simulate the action
      Returns:
      the fluidstack which was picked up, or FluidStack.EMPTY
    • tryPourOutFluid

      public static boolean tryPourOutFluid(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> fluidCap, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, boolean playSound, boolean force, net.minecraftforge.fluids.capability.IFluidHandler.FluidAction action)
      Try to pour 1000mB (one bucket) of fluid into the world at the given position.
      Parameters:
      fluidCap - the fluid capability
      world - the world
      pos - block to pour fluid at
      playSound - true to play a bucket-empty sound
      force - if true, fluid will be poured out even if the block space is not completely empty
      Returns:
      true if fluid was poured, false otherwise
    • matchFluid

      public static boolean matchFluid(FluidIngredient fluidIngredient, net.minecraftforge.fluids.FluidStack fluidStack, boolean matchTags)
    • matchFluid

      public static boolean matchFluid(FluidIngredient fluidIngredient, net.minecraft.world.level.material.Fluid fluid, boolean matchTags)