Interface JavaRegistryReader.Context

All Superinterfaces:
JavaRegistryProvider.Provider
All Known Implementing Classes:
RegistryEntryContext
Enclosing interface:
JavaRegistryReader<T>

public static interface JavaRegistryReader.Context extends JavaRegistryProvider.Provider
Provides context around a registry entry (serialised to NBT), such as a JavaRegistryProvider, and optionally the GeyserSession.
  • 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 an NbtMap, only use if you're sure the data is a compound tag.
      Returns:
      the registry entry, cast to an NbtMap
    • session

      This may be an empty Optional, and you should generally depend on the presence of this Optional as 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 use dataAsMap() to get this registry entry as an NbtMap, and then tries to parse the "description" key into a Component, using MessageTranslator.componentFromNbtTag(Object). If the key did not exist, an empty component is returned.
      Returns:
      the "description" key from this entry, parsed as a Component
    • deserializeDescription

      default String deserializeDescription()
      Uses MessageTranslator.convertFromNullableNbtTag(Optional, Object) 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