Class CapabilityToken<T>

java.lang.Object
net.neoforged.neoforge.common.capabilities.CapabilityToken<T>

public abstract class CapabilityToken<T> extends Object
Inspired by TypeToken, use a subclass to capture generic types. Then uses a transformer to convert that generic into a string returned by getType() This allows us to know the generic type, without having a hard reference to the class. Example usage:

 public static Capability<IDataHolder> DATA_HOLDER_CAPABILITY = CapabilityManager.get(new CapabilityToken<>() {});
 
  • Constructor Details

    • CapabilityToken

      public CapabilityToken()
  • Method Details