Class MutableRegistryEntryContextImpl<V>

java.lang.Object
org.quiltmc.qsl.frozenblock.core.registry.impl.event.MutableRegistryEntryContextImpl<V>
Type Parameters:
V - the type of the relevant Registry's entries
All Implemented Interfaces:
RegistryEntryContext<V>

@Internal public class MutableRegistryEntryContextImpl<V> extends Object implements RegistryEntryContext<V>
The default implementation for RegistryEntryContext.

In order to minimize allocations during event invocation, especially during registry iteration, this class is mutable. The api interface only allows accessing fields of the class, whereas modification methods are reserved for the impl.

Modified to work on Fabric

  • Constructor Summary

    Constructors
    Constructor
    Description
    MutableRegistryEntryContextImpl(net.minecraft.core.Registry<V> registry)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the entry's raw int identifier.
    net.minecraft.core.Registry<V>
    Returns the relevant registry for this entry.
    net.minecraft.resources.ResourceLocation
    Returns the entry's namespaced identifier.
    void
    set(net.minecraft.resources.ResourceLocation id, V entry)
    Changes the current entry information.
    void
    set(net.minecraft.resources.ResourceLocation id, V entry, int rawId)
    Changes the current entry information.
    Returns the entry's object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.quiltmc.qsl.frozenblock.core.registry.api.event.RegistryEntryContext

    register
  • Constructor Details

    • MutableRegistryEntryContextImpl

      public MutableRegistryEntryContextImpl(net.minecraft.core.Registry<V> registry)
  • Method Details

    • set

      public void set(net.minecraft.resources.ResourceLocation id, V entry)
      Changes the current entry information.

      Raw identifier is set to -1 to signify that it should be lazily looked up.

      Parameters:
      id - the namespaced identifier of the new entry
      entry - the new entry's object
    • set

      public void set(net.minecraft.resources.ResourceLocation id, V entry, int rawId)
      Changes the current entry information.
      Parameters:
      id - the namespaced identifier of the new entry
      entry - the new entry's object
      rawId - the raw int identifier of the new entry
    • registry

      public net.minecraft.core.Registry<V> registry()
      Description copied from interface: RegistryEntryContext
      Returns the relevant registry for this entry.
      Specified by:
      registry in interface RegistryEntryContext<V>
      Returns:
      the relevant registry for this entry
    • value

      public V value()
      Description copied from interface: RegistryEntryContext
      Returns the entry's object.
      Specified by:
      value in interface RegistryEntryContext<V>
      Returns:
      the entry's object
    • resourceLocation

      public net.minecraft.resources.ResourceLocation resourceLocation()
      Description copied from interface: RegistryEntryContext
      Returns the entry's namespaced identifier.
      Specified by:
      resourceLocation in interface RegistryEntryContext<V>
      Returns:
      the entry's namespaced identifier
    • rawId

      public int rawId()
      Description copied from interface: RegistryEntryContext
      Returns the entry's raw int identifier.
      Specified by:
      rawId in interface RegistryEntryContext<V>
      Returns:
      the entry's raw int identifier