Class AnnotatedRegistryLoader<R,​A extends Annotation,​V>

java.lang.Object
org.geysermc.geyser.registry.loader.AnnotatedRegistryLoader<R,​A,​V>
Type Parameters:
R - the final result as transformed by the function
A - the raw annotation itself can be transformed
V - the value
All Implemented Interfaces:
RegistryLoader<String,​Map<R,​V>>
Direct Known Subclasses:
SoundTranslatorRegistryLoader

public class AnnotatedRegistryLoader<R,​A extends Annotation,​V> extends Object implements RegistryLoader<String,​Map<R,​V>>
A mapped registry loader which takes in a String and returns a transformed Annotation as the value. The AnnotatedRegistryLoader represents the final result as mapped by the AnnotatedRegistryLoader, the annotation. This function exists in this registry loader for the purpose of annotations not often being used as a map key. The AnnotatedRegistryLoader generic represents the actual map value of what is expected. The function transformation done is used for transforming the key, however the value is not expected to be transformed.

Keep in mind that this annotation transforming does NOT need to be done, and can be replaced with a simple Function.identity() if not desired.

See BlockEntityRegistryLoader and SoundTranslatorRegistryLoader as a good example of these registry loaders in use.

  • Constructor Details

    • AnnotatedRegistryLoader

      public AnnotatedRegistryLoader(Class<A> annotation, Function<A,​R> mapper)
  • Method Details