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.convertFromNullableNbtTag(Optional, Object)to convert the"description"key from this registry entry into a bedrock text string.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).session()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
-
session
Optional<GeyserSession> session()This may be an emptyOptional, and you should generally depend on the presence of thisOptionalas little as possible.For accessing registry data, use
JavaRegistryProvider.Provider.registries()instead.- Returns:
- the current
GeyserSession, may be empty
-
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.convertFromNullableNbtTag(Optional, Object)to convert the"description"key from this registry entry into a bedrock text string. This will return"MISSING GEYSER SESSION"whensession()is empty.- Returns:
- the
"description"key from this entry, converted to a bedrock text string
-