Class FluidUtils
java.lang.Object
me.desht.pneumaticcraft.common.util.FluidUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisFlowingFluidBlock(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 booleanisFlowingFluidBlock(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 booleanisSourceFluidBlock(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Check if the given blockpos contains a fluid source block.static booleanisSourceFluidBlock(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 booleanmatchFluid(FluidIngredient fluidIngredient, net.minecraft.world.level.material.Fluid fluid, boolean matchTags) static booleanmatchFluid(FluidIngredient fluidIngredient, net.minecraftforge.fluids.FluidStack fluidStack, boolean matchTags) static booleantryFluidExtraction(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 booleantryFluidExtraction(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 booleantryFluidInsertion(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 booleantryFluidInsertion(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.FluidStacktryPickupFluid(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 booleantryPourOutFluid(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.
-
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 fluiddestStack- the fluid container item to extract fromreturnedItems- 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 fromsrcStack- the fluid container item to insert toreturnedItems- 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 intoface- the face of the block entity's block to insert toplayer- the playerhand- 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 fromface- the face of the block entity's block to extract fromplayer- the playerhand- 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 worldpos- 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 worldpos- the blockposfluid- 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 worldpos- 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 worldpos- the blockposfluid- 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 toworld- the worldpos- the block pos to pull fluid fromplaySound- true to play a bucket-fill soundaction- 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 capabilityworld- the worldpos- block to pour fluid atplaySound- true to play a bucket-empty soundforce- 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)
-