Class AEKeyTypes

java.lang.Object
appeng.api.stacks.AEKeyTypes

public final class AEKeyTypes extends Object
AE2's registry of all known key types.

AE2 has built-in item and fluid key types. Addons can register additional key types during initialization using register(AEKeyType).

  • Method Details

    • register

      public static void register(AEKeyType keyType)
      Register a new storage channel.

      AE2 already provides native channels for AEItemKey and AEFluidKey.

      Each AEKey subtype can only have a single factory instance. Overwriting is not intended. Each subtype should be a direct one, this might be enforced at any time.

      Channel class and factory instance can be used interchangeable as identifier. In most cases the factory instance is used as key as having direct access the methods is more beneficial compared to being forced to query the registry each time.

      Caching the factory instance in a field or local variable is perfectly for performance reasons. But do not use any AE2 internal field as they can change randomly between releases.

    • get

      public static AEKeyType get(net.minecraft.resources.ResourceLocation id)
      Fetch the implementation for a specific storage channel id.
      Parameters:
      id - The storage channel id.
      Returns:
      The storage channel implementation.
      Throws:
      IllegalArgumentException - when fetching an unregistered channel.
    • getAll

      public static Set<AEKeyType> getAll()
      An unmodifiable collection of all registered key types.

      This is mainly used as helper to let storage grids construct their internal storage for each type.