Record Class RegistryEntryContext

java.lang.Object
java.lang.Record
org.geysermc.geyser.session.cache.registry.RegistryEntryContext
Record Components:
entry - the registry entry being read.
keyIdFunction - a function that turns a resource location in the registry to its respective network ID.
session - the Geyser session. Only empty during testing.

public record RegistryEntryContext(org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry entry, ToIntFunction<net.kyori.adventure.key.Key> keyIdFunction, Optional<GeyserSession> session) extends Record
Used to store context around a single registry entry when reading said entry's NBT.
  • Constructor Details

    • RegistryEntryContext

      public RegistryEntryContext(org.geysermc.mcprotocollib.protocol.data.game.RegistryEntry entry, ToIntFunction<net.kyori.adventure.key.Key> keyIdFunction, Optional<GeyserSession> session)
      Creates an instance of a RegistryEntryContext record class.
      Parameters:
      entry - the value for the entry record component
      keyIdFunction - the value for the keyIdFunction record component
      session - the value for the session record component
  • Method Details

    • getNetworkId

      public int getNetworkId(net.kyori.adventure.key.Key registryKey)
    • id

      public net.kyori.adventure.key.Key id()
    • data

      public org.cloudburstmc.nbt.NbtMap data()
    • deserializeDescription

      public String deserializeDescription()
    • 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.
    • 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
    • keyIdFunction

      public ToIntFunction<net.kyori.adventure.key.Key> keyIdFunction()
      Returns the value of the keyIdFunction record component.
      Returns:
      the value of the keyIdFunction record component
    • session

      public Optional<GeyserSession> session()
      Returns the value of the session record component.
      Returns:
      the value of the session record component