类 CapabilityToken<T>
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityToken<T>
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<>(){});
-
构造器概要
构造器 -
方法概要