Package org.cyclops.cyclopscore.helper
Class FluidHelpersNeoForge
java.lang.Object
org.cyclops.cyclopscore.helper.FluidHelpersNeoForge
- All Implemented Interfaces:
IFluidHelpersNeoForge
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.net.neoforged.neoforge.fluids.FluidStack
copy
(net.neoforged.neoforge.fluids.FluidStack fluidStack) Copy the given fluid stacknet.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.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.int
getAmount
(net.neoforged.neoforge.fluids.FluidStack fluidStack) Get the fluid amount of the given stack in a safe manner.int
int
getCapacity
(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the capacity of a fluid handler.net.neoforged.neoforge.fluids.FluidStack
getFluid
(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Get the fluid contained in a fluid handler.getFluidHandlerItemCapacity
(net.minecraft.world.item.ItemStack itemStack) boolean
hasFluid
(@Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Check if the fluid handler is not empty.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.net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction
simulateBooleanToAction
(boolean simulate) Convert a boolean-based simulate to a fluid action enum value.
-
Constructor Details
-
FluidHelpersNeoForge
public FluidHelpersNeoForge()
-
-
Method Details
-
getBucketVolume
public int getBucketVolume()- Specified by:
getBucketVolume
in interfaceIFluidHelpersNeoForge
-
getAmount
public int getAmount(net.neoforged.neoforge.fluids.FluidStack fluidStack) Description copied from interface:IFluidHelpersNeoForge
Get the fluid amount of the given stack in a safe manner.- Specified by:
getAmount
in interfaceIFluidHelpersNeoForge
- Parameters:
fluidStack
- The fluid stack- Returns:
- The fluid amount.
-
copy
public net.neoforged.neoforge.fluids.FluidStack copy(net.neoforged.neoforge.fluids.FluidStack fluidStack) Description copied from interface:IFluidHelpersNeoForge
Copy the given fluid stack- Specified by:
copy
in interfaceIFluidHelpersNeoForge
- Parameters:
fluidStack
- The fluid stack to copy.- Returns:
- A copy of the fluid stack.
-
canCompletelyFill
public boolean canCompletelyFill(net.neoforged.neoforge.fluids.capability.IFluidHandler source, net.neoforged.neoforge.fluids.capability.IFluidHandler destination) Description copied from interface:IFluidHelpersNeoForge
If this destination can completely contain the given fluid in the given source.- Specified by:
canCompletelyFill
in interfaceIFluidHelpersNeoForge
- 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
public net.neoforged.neoforge.fluids.FluidStack getFluid(@Nullable @Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Description copied from interface:IFluidHelpersNeoForge
Get the fluid contained in a fluid handler.- Specified by:
getFluid
in interfaceIFluidHelpersNeoForge
- Parameters:
fluidHandler
- The fluid handler.- Returns:
- The fluid.
-
hasFluid
public boolean hasFluid(@Nullable @Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Description copied from interface:IFluidHelpersNeoForge
Check if the fluid handler is not empty.- Specified by:
hasFluid
in interfaceIFluidHelpersNeoForge
- Parameters:
fluidHandler
- The fluid handler.- Returns:
- If it is not empty.
-
getCapacity
public int getCapacity(@Nullable @Nullable net.neoforged.neoforge.fluids.capability.IFluidHandler fluidHandler) Description copied from interface:IFluidHelpersNeoForge
Get the capacity of a fluid handler.- Specified by:
getCapacity
in interfaceIFluidHelpersNeoForge
- Parameters:
fluidHandler
- The fluid handler.- Returns:
- The capacity.
-
getFluidHandlerItemCapacity
public Optional<IFluidHandlerItemCapacity> getFluidHandlerItemCapacity(net.minecraft.world.item.ItemStack itemStack) - Specified by:
getFluidHandlerItemCapacity
in interfaceIFluidHelpersNeoForge
- Parameters:
itemStack
- The itemstack- Returns:
- The item capacity fluid handler.
-
extractFromInventory
public net.neoforged.neoforge.fluids.FluidStack extractFromInventory(int amount, @Nullable @Nullable net.minecraft.world.item.ItemStack blacklistedStack, @Nullable @Nullable net.minecraft.world.level.material.Fluid fluidWhitelist, net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Description copied from interface:IFluidHelpersNeoForge
Extract the given fluid amount from any item inside the player's inventory.- Specified by:
extractFromInventory
in interfaceIFluidHelpersNeoForge
- 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
public net.neoforged.neoforge.fluids.FluidStack extractFromItemOrInventory(int amount, net.minecraft.world.item.ItemStack itemStack, @Nullable @Nullable net.minecraft.world.entity.player.Player player, net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction action) Description copied from interface:IFluidHelpersNeoForge
Extract the given fluid amount from the given item, or from the player's inventory if that fails.- Specified by:
extractFromItemOrInventory
in interfaceIFluidHelpersNeoForge
- 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
public 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) Description copied from interface:IFluidHelpersNeoForge
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)
.- Specified by:
placeOrPickUpFluid
in interfaceIFluidHelpersNeoForge
- Parameters:
player
- The active player.hand
- The active hand.world
- The world.blockPos
- The target position.side
- The target side.
-
simulateBooleanToAction
public net.neoforged.neoforge.fluids.capability.IFluidHandler.FluidAction simulateBooleanToAction(boolean simulate) Description copied from interface:IFluidHelpersNeoForge
Convert a boolean-based simulate to a fluid action enum value.- Specified by:
simulateBooleanToAction
in interfaceIFluidHelpersNeoForge
- Parameters:
simulate
- If in simulation mode.- Returns:
- The fluid action.
-