Class EmptyFluidIngredient

java.lang.Object
net.neoforged.neoforge.fluids.crafting.FluidIngredient
net.neoforged.neoforge.fluids.crafting.EmptyFluidIngredient
All Implemented Interfaces:
Predicate<FluidStack>

public class EmptyFluidIngredient extends FluidIngredient
Singleton that represents an empty fluid ingredient.

This is the only instance of an explicitly empty ingredient, and may be used as a fallback in FluidIngredient convenience methods (such as when trying to create an ingredient from an empty list).

See Also:
  • Field Details

  • Constructor Details

    • EmptyFluidIngredient

      private EmptyFluidIngredient()
  • Method Details

    • test

      public boolean test(FluidStack fluidStack)
      Description copied from class: FluidIngredient
      Checks if a given fluid stack matches this ingredient. The stack must not be modified in any way.
      Specified by:
      test in interface Predicate<FluidStack>
      Specified by:
      test in class FluidIngredient
      Parameters:
      fluidStack - the stack to test
      Returns:
      true if the stack matches, false otherwise
    • generateStacks

      protected Stream<FluidStack> generateStacks()
      Description copied from class: FluidIngredient
      Generates a stream of all fluid stacks this ingredient matches against.

      For compatibility reasons, implementations should follow the same guidelines as for custom item ingredients, i.e.:

      • These stacks are generally used for display purposes, and need not be exhaustive or perfectly accurate.
      • An exception is ingredients that are simple, for which it is important that the returned stacks correspond exactly to all the accepted Fluids.
      • At least one stack should always be returned, otherwise the ingredient may be considered accidentally empty.
      • The ingredient should try to return at least one stack with each accepted Fluid. This allows mods that inspect the ingredient to figure out which stacks it might accept.
      Specified by:
      generateStacks in class FluidIngredient
      Returns:
      a stream of all fluid stacks this ingredient accepts.

      Note: No guarantees are made as to the amount of the fluid, as FluidIngredients are generally not meant to match by amount and these stacks are mostly used for display.

      See Also:
    • isSimple

      public boolean isSimple()
      Description copied from class: FluidIngredient
      Returns whether this fluid ingredient always requires direct stack testing.
      Specified by:
      isSimple in class FluidIngredient
      Returns:
      true if this ingredient ignores NBT data when matching stacks, false otherwise
      See Also:
    • getType

      public FluidIngredientType<?> getType()
      Description copied from class: FluidIngredient
      Returns The type of this fluid ingredient..

      The type must be registered to NeoForgeRegistries.FLUID_INGREDIENT_TYPES.

      Specified by:
      getType in class FluidIngredient
      Returns:
      The type of this fluid ingredient.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class FluidIngredient
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class FluidIngredient