Package org.cyclops.cyclopscore.helper
Interface IFluidHelpersNeoForge
- All Known Implementing Classes:
FluidHelpersNeoForge
public interface IFluidHelpersNeoForge
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanCompletelyFill(net.neoforged.neoforge.fluids.capability.IFluidHandler source, net.neoforged.neoforge.fluids.capability.IFluidHandler destination) If this destination can completely contain the given fluid in the given source.net.neoforged.neoforge.fluids.FluidStackcopy(net.neoforged.neoforge.fluids.FluidStack fluidStack) Copy the given fluid stacknet.neoforged.neoforge.fluids.FluidStackextractFromInventory(int amount, net.minecraft.world.item.ItemStack blacklistedStack, net.minecraft.world.level.material.Fluid fluidWhitelist, net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Extract the given fluid amount from any item inside the player's inventory.net.neoforged.neoforge.fluids.FluidStackextractFromItemOrInventory(int amount, net.minecraft.world.item.ItemStack itemStack, net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Extract the given fluid amount from the given item, or from the player's inventory if that fails.intgetAmount(net.neoforged.neoforge.fluids.FluidStack fluidStack) Get the fluid amount of the given stack in a safe manner.intintgetCapacity(net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the capacity of a fluid handler.net.neoforged.neoforge.fluids.FluidStackgetFluid(net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the fluid contained in a fluid handler.getFluidHandlerItemCapacity(net.minecraft.world.item.ItemStack itemStack) booleanhasFluid(net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Check if the fluid handler is not empty.voidplaceOrPickUpFluid(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos blockPos, net.minecraft.core.Direction side) Try placing or picking up fluids from the held item.net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidActionsimulateBooleanToAction(boolean simulate) Convert a boolean-based simulate to a fluid action enum value.
-
Method Details
-
getBucketVolume
int getBucketVolume() -
getAmount
int getAmount(net.neoforged.neoforge.fluids.FluidStack fluidStack) Get the fluid amount of the given stack in a safe manner.- Parameters:
fluidStack- The fluid stack- Returns:
- The fluid amount.
-
copy
net.neoforged.neoforge.fluids.FluidStack copy(net.neoforged.neoforge.fluids.FluidStack fluidStack) Copy the given fluid stack- Parameters:
fluidStack- The fluid stack to copy.- Returns:
- A copy of the fluid stack.
-
canCompletelyFill
boolean canCompletelyFill(net.neoforged.neoforge.fluids.capability.IFluidHandler source, net.neoforged.neoforge.fluids.capability.IFluidHandler destination) If this destination can completely contain the given fluid in the given source.- Parameters:
source- The source of the fluid that has to be moved.destination- The target of the fluid that has to be moved.- Returns:
- If the destination can completely contain the fluid of the source.
-
getFluid
net.neoforged.neoforge.fluids.FluidStack getFluid(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the fluid contained in a fluid handler.- Parameters:
fluidHandler- The fluid handler.- Returns:
- The fluid.
-
hasFluid
boolean hasFluid(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Check if the fluid handler is not empty.- Parameters:
fluidHandler- The fluid handler.- Returns:
- If it is not empty.
-
getCapacity
int getCapacity(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the capacity of a fluid handler.- Parameters:
fluidHandler- The fluid handler.- Returns:
- The capacity.
-
getFluidHandlerItemCapacity
Optional<IFluidHandlerItemCapacity> getFluidHandlerItemCapacity(net.minecraft.world.item.ItemStack itemStack) - Parameters:
itemStack- The itemstack- Returns:
- The item capacity fluid handler.
-
extractFromInventory
net.neoforged.neoforge.fluids.FluidStack extractFromInventory(int amount, @Nullable net.minecraft.world.item.ItemStack blacklistedStack, @Nullable net.minecraft.world.level.material.Fluid fluidWhitelist, net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Extract the given fluid amount from any item inside the player's inventory.- Parameters:
amount- A fluid amount to extract.blacklistedStack- The itemstack to skip. Useful if this is the stack that you are inserting to.fluidWhitelist- A fluid to transfer, can be null to allow any fluid to be transferred.player- The player to scan the inventory from.action- The fluid action.- Returns:
- The extracted fluidstack.
-
extractFromItemOrInventory
net.neoforged.neoforge.fluids.FluidStack extractFromItemOrInventory(int amount, net.minecraft.world.item.ItemStack itemStack, @Nullable net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Extract the given fluid amount from the given item, or from the player's inventory if that fails.- Parameters:
amount- A fluid amount to extract.itemStack- The item to extract from first.player- The player to scan the inventory from.action- The fluid action.- Returns:
- The extracted fluidstack.
-
placeOrPickUpFluid
void placeOrPickUpFluid(net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos blockPos, net.minecraft.core.Direction side) Try placing or picking up fluids from the held item. This can be called inItem.use(net.minecraft.world.level.Level, net.minecraft.world.entity.player.Player, net.minecraft.world.InteractionHand).- Parameters:
player- The active player.hand- The active hand.world- The world.blockPos- The target position.side- The target side.
-
simulateBooleanToAction
net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction simulateBooleanToAction(boolean simulate) Convert a boolean-based simulate to a fluid action enum value.- Parameters:
simulate- If in simulation mode.- Returns:
- The fluid action.
-