Interface JavaRegistryReader.Context
- All Superinterfaces:
JavaRegistryProvider.Provider
- All Known Implementing Classes:
RegistryEntryContext
- Enclosing interface:
JavaRegistryReader<T>
Provides context around a registry entry (serialised to NBT), such as a
JavaRegistryProvider, and optionally the GeyserSession.-
Method Summary
Modifier and TypeMethodDescriptiondata()default org.cloudburstmc.nbt.NbtMapNote that this unsafely casts the data to anNbtMap, only use if you're sure the data is a compound tag.default StringUsesMessageTranslator.convertLenientNbtMessage(Object, String)to convert the"description"key from this registry entry into a bedrock text string.locale()The context's locale: may be used to translate text components in registry data ahead of time.default net.kyori.adventure.text.ComponentAttempts to usedataAsMap()to get this registry entry as anNbtMap, and then tries to parse the"description"key into aComponent, usingMessageTranslator.componentFromNbtTag(Object).Methods inherited from interface org.geysermc.geyser.registry.java.JavaRegistryProvider.Provider
registries
-
Method Details
-
data
Object data()- Returns:
- the registry entry to parse, serialised to NBT
-
dataAsMap
default org.cloudburstmc.nbt.NbtMap dataAsMap()Note that this unsafely casts the data to anNbtMap, only use if you're sure the data is a compound tag.- Returns:
- the registry entry, cast to an
NbtMap
-
locale
String locale()The context's locale: may be used to translate text components in registry data ahead of time.- Returns:
- the context's locale, to be used when translating text components using
MessageTranslator
-
parseDescription
default net.kyori.adventure.text.Component parseDescription()Attempts to usedataAsMap()to get this registry entry as anNbtMap, and then tries to parse the"description"key into aComponent, usingMessageTranslator.componentFromNbtTag(Object). If the key did not exist, an empty component is returned.- Returns:
- the
"description"key from this entry, parsed as aComponent
-
deserializeDescription
UsesMessageTranslator.convertLenientNbtMessage(Object, String)to convert the"description"key from this registry entry into a bedrock text string.- Returns:
- the
"description"key from this entry, converted to a bedrock text string
-