Record Class DynamicRegistryManagerSetupContext.RegistryMap

java.lang.Object
java.lang.Record
org.quiltmc.qsl.frozenblock.core.registry.api.event.DynamicRegistryManagerSetupContext.RegistryMap
Record Components:
registries - the map of registries
Enclosing interface:
DynamicRegistryManagerSetupContext

public static record DynamicRegistryManagerSetupContext.RegistryMap(Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,net.minecraft.core.Registry<?>> registries) extends Record
Represents a map of known registries.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    <V> net.minecraft.core.Registry<V>
    get(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registryKey)
    Gets the registry from its key in this map.
    final int
    Returns a hash code value for this object.
    <V> V
    register(@NotNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registryKey, @NotNull net.minecraft.resources.ResourceLocation id, V gameObject)
    Registers the given game object into the given registry.
    Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,net.minecraft.core.Registry<?>>
    Returns the value of the registries record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • RegistryMap

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

    • get

      @Contract(pure=true) public <V> net.minecraft.core.Registry<V> get(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registryKey)
      Gets the registry from its key in this map.
      Type Parameters:
      V - the type of values held in the registry
      Parameters:
      registryKey - the key of the registry
      Returns:
      the registry if present, or null otherwise
    • register

      @NotNull public <V> V register(@NotNull @NotNull net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<V>> registryKey, @NotNull @NotNull net.minecraft.resources.ResourceLocation id, @NotNull V gameObject)
      Registers the given game object into the given registry.
      Type Parameters:
      V - the type of values held in the registry
      Parameters:
      registryKey - the key of the registry to register into
      id - the identifier of the game object to register
      gameObject - the game object to register
      Returns:
      the game object
    • 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 Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,net.minecraft.core.Registry<?>> registries()
      Returns the value of the registries record component.
      Returns:
      the value of the registries record component