Interface IngredientConverter<T>


public interface IngredientConverter<T>
Implement this interface to provide AE2s REI integration with a new ingredient type converter for use in:
  • Recipe transfers
  • Pressing R/U on custom stacks in AE2 user interfaces
  • Dragging ghost items of custom types from REI to AE2 interfaces

To register your converter, see IngredientConverters.

  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable me.shedaniel.rei.api.common.entry.EntryStack<T>
    Converts a generic stack into one of the ingredient handled by this converter.
    me.shedaniel.rei.api.common.entry.type.EntryType<T>
    The REI ingredient type handled by this converter.
    @Nullable GenericStack
    getStackFromIngredient(me.shedaniel.rei.api.common.entry.EntryStack<T> ingredient)
    Converts an ingredient handled by this converter into a generic stack.
  • Method Details

    • getIngredientType

      me.shedaniel.rei.api.common.entry.type.EntryType<T> getIngredientType()
      The REI ingredient type handled by this converter.
    • getIngredientFromStack

      @Nullable @Nullable me.shedaniel.rei.api.common.entry.EntryStack<T> getIngredientFromStack(GenericStack stack)
      Converts a generic stack into one of the ingredient handled by this converter.

      The converter needs to ensure the minimum amount of the returned ingredient is 1 if the resulting ingredient represents amounts of 0 as "empty", since this would not preserve the ingredient type correctly.

      Example: Math.max(1, Ints.saturatedCast(stack.amount())) (for Item and Fluid stacks).

      Returns:
      Null if the converter can't handle the stack.
    • getStackFromIngredient

      @Nullable @Nullable GenericStack getStackFromIngredient(me.shedaniel.rei.api.common.entry.EntryStack<T> ingredient)
      Converts an ingredient handled by this converter into a generic stack.
      Returns:
      Null if the ingredient represents an "empty" ingredient (i.e. ItemStack.EMPTY.