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 or data from a GeyserSession.
All readers are registered, one for each of Java's networked-registries, in JavaRegistryReaders.
Note however that GeyserSession may not always be present when parsing registry data - it should generally only be used to pre-compute text component translations
(see JavaRegistryReader.Context.parseDescription()).
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 context around a registry entry (serialised to NBT), such as aJavaRegistryProvider, and optionally theGeyserSession. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JavaRegistryReader<RegistryUnit> AJavaRegistryReaderthat always returnsRegistryUnit.INSTANCE. -
Method Summary
Modifier and TypeMethodDescriptionstatic JavaRegistryReader.ContextcreateContext(JavaRegistryProvider registries, Optional<GeyserSession> session, 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
static JavaRegistryReader.Context createContext(JavaRegistryProvider registries, Optional<GeyserSession> session, Object data) Creates aJavaRegistryReader.Contextfor parsing a registry entry. Should be used to parse inline entries.- Parameters:
registries- theJavaRegistryProvidersession- theGeyserSession, may be emptydata- the registry entry to parse- Returns:
- the created
JavaRegistryReader.Context
-