Interface LazuliItem


public interface LazuliItem
Provides a large handful of generic helpers for items. None of the methods need to be implemented, everything has a default.
TODO: Energy helpers and move helpers to more specific interfaces (`IEnergyItem`, `IFluidItem`)
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Get the default mB that this item's tank can hold.
    default @Nullable net.neoforged.neoforge.fluids.FluidStack
    getFluid(net.minecraft.world.item.ItemStack stack)
    Get the FluidStack contained in the item's first tank.
    default @Nullable net.neoforged.neoforge.fluids.FluidStack
    getFluid(net.minecraft.world.item.ItemStack stack, int tank)
    Get the FluidStack contained in the given tank.
    default @Nullable net.neoforged.neoforge.fluids.capability.IFluidHandlerItem
    getFluidHandler(net.minecraft.world.item.ItemStack stack)
    Get the fluid handler for the given stack.
    default int
    getFluidTankCapacity(net.minecraft.world.item.ItemStack stack)
    Get the fluid tank capacity in mB of the item's first tank.
    default int
    getFluidTankCapacity(net.minecraft.world.item.ItemStack stack, int tank)
    Get the fluid tank capacity in mB of the given tank.
    default boolean
    hasFluid(net.minecraft.world.item.ItemStack stack)
    Returns true if the stack has a fluid in its tank.
    default boolean
    Get whether the item has a fluid tank.
    default net.neoforged.neoforge.fluids.capability.IFluidHandlerItem
    makeFluidHandler(net.minecraft.world.item.ItemStack stack)
    Creates a fluid handler for the item.
  • Method Details

    • hasFluidTank

      default boolean hasFluidTank()
      Get whether the item has a fluid tank.
      Returns:
      `true` if this item has a fluid tank.
    • getDefaultFluidHandlerCapacity

      default int getDefaultFluidHandlerCapacity()
      Get the default mB that this item's tank can hold.
      Returns:
      The amount of mB.
    • makeFluidHandler

      default net.neoforged.neoforge.fluids.capability.IFluidHandlerItem makeFluidHandler(net.minecraft.world.item.ItemStack stack)
      Creates a fluid handler for the item.
      Parameters:
      stack - The item stack.
      Returns:
      A fluid handler.
    • getFluidHandler

      @Nullable default @Nullable net.neoforged.neoforge.fluids.capability.IFluidHandlerItem getFluidHandler(net.minecraft.world.item.ItemStack stack)
      Get the fluid handler for the given stack.
      Parameters:
      stack - The stack.
      Returns:
      The fluid handler.
    • hasFluid

      default boolean hasFluid(net.minecraft.world.item.ItemStack stack)
      Returns true if the stack has a fluid in its tank.
      **This method will throw an exception if the item does not have a fluid handler.**
      Parameters:
      stack - The stack.
      Returns:
      Whether the tank contains fluid.
    • getFluid

      @Nullable default @Nullable net.neoforged.neoforge.fluids.FluidStack getFluid(net.minecraft.world.item.ItemStack stack, int tank)
      Get the FluidStack contained in the given tank.
      **This method will throw an exception if the item does not have a fluid handler.**
      Parameters:
      stack - The stack.
      tank - The tank's index.
      Returns:
      The fluid stack.
    • getFluid

      @Nullable default @Nullable net.neoforged.neoforge.fluids.FluidStack getFluid(net.minecraft.world.item.ItemStack stack)
      Get the FluidStack contained in the item's first tank.
      Parameters:
      stack - The stack.
      Returns:
      The fluid stack.
    • getFluidTankCapacity

      default int getFluidTankCapacity(net.minecraft.world.item.ItemStack stack, int tank)
      Get the fluid tank capacity in mB of the given tank.
      **This method will throw an exception if the item does not have a fluid handler.**
      Parameters:
      stack - The stack.
      tank - The tank's index.
      Returns:
      The capacity.
    • getFluidTankCapacity

      default int getFluidTankCapacity(net.minecraft.world.item.ItemStack stack)
      Get the fluid tank capacity in mB of the item's first tank.
      Parameters:
      stack - The stack.
      Returns:
      The capacity.