Record Class RegistryInfoLookupImpl

java.lang.Object
java.lang.Record
top.qwertycxz.loadabledialog.RegistryInfoLookupImpl
Record Components:
info - the map of registry keys to registry info, which is used for looking up registries when loading dialogs
All Implemented Interfaces:
net.minecraft.resources.RegistryOps.RegistryInfoLookup

@NullMarked public record RegistryInfoLookupImpl(Map<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, ? extends net.minecraft.resources.RegistryOps.RegistryInfo<?>> info) extends Record implements net.minecraft.resources.RegistryOps.RegistryInfoLookup

Main class of the mod

For the instance of this class, it is just a thin wrapper around a map of registry keys to registry info, which is used for looking up registries when loading dialogs.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<net.minecraft.server.level.ServerPlayer>
    A set of players whose client is not up-to-date with the server, so we should not send them dialogs.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegistryInfoLookupImpl(Map<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, ? extends net.minecraft.resources.RegistryOps.RegistryInfo<?>> info)
    Creates an instance of a RegistryInfoLookupImpl record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Map<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, ? extends net.minecraft.resources.RegistryOps.RegistryInfo<?>>
    Returns the value of the info record component.
    static net.minecraft.core.RegistryAccess.Frozen
    loadDialog(net.minecraft.core.RegistryAccess.Frozen layer, net.minecraft.core.HolderLookup.Provider access, net.minecraft.server.packs.resources.ResourceManager manager)
    Loads dialogs from the resource manager and returns a frozen registry access containing the dialog registry.
    <U> Optional<net.minecraft.resources.RegistryOps.RegistryInfo<U>>
    lookup(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends U>> key)
    Creates a new registry info lookup with the given map
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • STALE_PLAYERS

      public static final Set<net.minecraft.server.level.ServerPlayer> STALE_PLAYERS
      A set of players whose client is not up-to-date with the server, so we should not send them dialogs.
  • Constructor Details

    • RegistryInfoLookupImpl

      public RegistryInfoLookupImpl(Map<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, ? extends net.minecraft.resources.RegistryOps.RegistryInfo<?>> info)
      Creates an instance of a RegistryInfoLookupImpl record class.
      Parameters:
      info - the value for the info record component
  • Method Details

    • lookup

      public <U> Optional<net.minecraft.resources.RegistryOps.RegistryInfo<U>> lookup(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends U>> key)
      Creates a new registry info lookup with the given map
      Specified by:
      lookup in interface net.minecraft.resources.RegistryOps.RegistryInfoLookup
      Parameters:
      key - the map of registry keys to registry info
      Returns:
      the registry info lookup
    • loadDialog

      public static net.minecraft.core.RegistryAccess.Frozen loadDialog(net.minecraft.core.RegistryAccess.Frozen layer, net.minecraft.core.HolderLookup.Provider access, net.minecraft.server.packs.resources.ResourceManager manager)
      Loads dialogs from the resource manager and returns a frozen registry access containing the dialog registry.
      Parameters:
      layer - layer n, the frozen registry access layer where the dialog registry will be added
      access - layers 0 ~ n-1, the provider of registry lookups as the base for dialog loading
      manager - the resource manager to load dialog JSONs from
      Returns:
      modified layer n, a frozen registry access containing the dialog registry
    • 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.
    • info

      public Map<? extends net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, ? extends net.minecraft.resources.RegistryOps.RegistryInfo<?>> info()
      Returns the value of the info record component.
      Returns:
      the value of the info record component