Record Class RegistryEntryContext

java.lang.Object
java.lang.Record
org.geysermc.geyser.registry.java.reader.RegistryEntryContext
Record Components:
registries - the JavaRegistryProvider
entry - the RegistryEntry
locale - the locale to use when translating text components
All Implemented Interfaces:
JavaRegistryProvider.Provider, JavaRegistryReader.Context

public record RegistryEntryContext(JavaRegistryProvider registries, org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry entry, String locale) extends Record implements JavaRegistryReader.Context
Expands JavaRegistryReader.Context with a Key. Used when parsing registry data from a ClientboundRegistryDataPacket.
  • Constructor Details

    • RegistryEntryContext

      public RegistryEntryContext(JavaRegistryProvider registries, org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry entry, String locale)
      Creates an instance of a RegistryEntryContext record class.
      Parameters:
      registries - the value for the registries record component
      entry - the value for the entry record component
      locale - the value for the locale record component
  • Method Details

    • id

      public net.kyori.adventure.key.Key id()
      Returns:
      the Key of this registry entry
    • data

      public Object data()
      Specified by:
      data in interface JavaRegistryReader.Context
      Returns:
      the registry entry to parse, serialised to NBT
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • registries

      public JavaRegistryProvider registries()
      Returns the value of the registries record component.
      Specified by:
      registries in interface JavaRegistryProvider.Provider
      Returns:
      the value of the registries record component
    • entry

      public org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry entry()
      Returns the value of the entry record component.
      Returns:
      the value of the entry record component
    • locale

      public String locale()
      Returns the value of the locale record component.
      Specified by:
      locale in interface JavaRegistryReader.Context
      Returns:
      the value of the locale record component