Interface EmiStackConverter


public interface EmiStackConverter
Implement this interface to provide AE2s EMI integration with a new way to convert between AE2 GenericStack and EmiStack.
  • Recipe transfers
  • Pressing R/U on custom stacks in AE2 user interfaces
  • Dragging ghost items of custom types from EMI to AE2 interfaces

To register your converter, see EmiStackConverters.

  • Method Summary

    Modifier and Type
    Method
    Description
    The EMI key type handled by this converter.
    @Nullable dev.emi.emi.api.stack.EmiStack
    Converts a generic stack into an EmiStack subtype handled by this converter.
    @Nullable GenericStack
    toGenericStack(dev.emi.emi.api.stack.EmiStack stack)
    Converts an EmiStack handled by this converter into a generic stack.
  • Method Details

    • getKeyType

      Class<?> getKeyType()
      The EMI key type handled by this converter. AE2 handles Fluid and Item already.
    • toEmiStack

      @Nullable @Nullable dev.emi.emi.api.stack.EmiStack toEmiStack(GenericStack stack)
      Converts a generic stack into an EmiStack subtype 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.
    • toGenericStack

      @Nullable @Nullable GenericStack toGenericStack(dev.emi.emi.api.stack.EmiStack stack)
      Converts an EmiStack handled by this converter into a generic stack.
      Returns:
      Null if the ingredient represents an "empty" ingredient (i.e. EmiStack.EMPTY.