Interface JavaRegistryReader<T>
- Type Parameters:
T- the type this reader parses into
- All Superinterfaces:
KeyDependentJavaRegistryReader<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface JavaRegistryReader<T>
extends KeyDependentJavaRegistryReader<T>
A
JavaRegistryReader is a function that takes a JavaRegistryReader.Context, holding an Object (the "registry entry", serialised as NBT),
and parses it into a JavaRegistryReader, possibly using other registries provided by JavaRegistryProvider.
All readers are registered, one for each of Java's networked-registries, in JavaRegistryReaders.
If you don't care about the contents of the registry, and only about the network ID ≪-≫ key mapping, you should use the UNIT reader.
Some readers, especially when trying to map dynamic Java content to static bedrock content, will need the Key of the entry they are parsing.
In this case, you should define a KeyDependentJavaRegistryReader instead. Please see the documentation there for the drawbacks of using one.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides a registry entry (serialised to NBT), and aJavaRegistryProvider. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JavaRegistryReader<RegistryUnit> AJavaRegistryReaderthat always returnsRegistryUnit.INSTANCE. -
Method Summary
Modifier and TypeMethodDescriptionstatic JavaRegistryReader.ContextcreateContext(JavaRegistryProvider registries, Object data) Creates aJavaRegistryReader.Contextfor parsing a registry entry.read(JavaRegistryReader.Context context) default Tread(RegistryEntryContext context)
-
Field Details
-
UNIT
AJavaRegistryReaderthat always returnsRegistryUnit.INSTANCE.
-
-
Method Details
-
read
- Specified by:
readin interfaceKeyDependentJavaRegistryReader<T>
-
read
-
createContext
Creates aJavaRegistryReader.Contextfor parsing a registry entry. Should be used to parse inline entries.- Parameters:
registries- theJavaRegistryProviderdata- the registry entry to parse- Returns:
- the created
JavaRegistryReader.Context
-