Class MutableDynamicRegistryManager

java.lang.Object
io.github.thecsdev.tcdcommons.client.world.registry.MutableDynamicRegistryManager
All Implemented Interfaces:
net.minecraft.registry.DynamicRegistryManager, net.minecraft.registry.RegistryWrapper.WrapperLookup
Direct Known Subclasses:
ClientSandboxWorldDRM

@Beta public class MutableDynamicRegistryManager extends Object implements net.minecraft.registry.DynamicRegistryManager
A DynamicRegistryManager that creates Registrys on demand when calling getOptional(RegistryKey) instead of returning Optional.empty().
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.registry.DynamicRegistryManager

    net.minecraft.registry.DynamicRegistryManager.Entry<T extends Object>, net.minecraft.registry.DynamicRegistryManager.Immutable, net.minecraft.registry.DynamicRegistryManager.ImmutableImpl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Map<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,? extends net.minecraft.registry.Registry<?>>
     
    protected final Method
     

    Fields inherited from interface net.minecraft.registry.DynamicRegistryManager

    EMPTY, LOGGER
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    MutableDynamicRegistryManager(List<? extends net.minecraft.registry.Registry<?>> registries)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T, R extends net.minecraft.registry.Registry<? extends T>>
    net.minecraft.registry.DynamicRegistryManager.Entry<T>
    createEntry(Map.Entry<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,R> entry)
    Creates a DynamicRegistryManager.Entry based on the given parameters.
    Primarily used in streamAllRegistries().
    static <T> net.minecraft.registry.DynamicRegistryManager.Entry<T>
    createEntry(net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>> key, net.minecraft.registry.Registry<?> value)
    Creates a DynamicRegistryManager.Entry based on the given parameters.
    final <E> Optional<net.minecraft.registry.Registry<E>>
    getOptional(net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<? extends E>> key)
     
    final Map<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,? extends net.minecraft.registry.Registry<?>>
    Returns the Registry Map associated with this MutableDynamicRegistryManager.
    final Stream<net.minecraft.registry.DynamicRegistryManager.Entry<?>>
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraft.registry.DynamicRegistryManager

    get, getOptionalWrapper, getRegistryLifecycle, streamAllRegistryKeys, toImmutable

    Methods inherited from interface net.minecraft.registry.RegistryWrapper.WrapperLookup

    createRegistryLookup, getOps, getWrapperOrThrow
  • Field Details

    • registriesPutMethod

      protected final Method registriesPutMethod
    • registries

      protected final Map<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,? extends net.minecraft.registry.Registry<?>> registries
  • Constructor Details

    • MutableDynamicRegistryManager

      public MutableDynamicRegistryManager()
    • MutableDynamicRegistryManager

      public MutableDynamicRegistryManager(List<? extends net.minecraft.registry.Registry<?>> registries)
  • Method Details

    • getRegistries

      public final Map<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,? extends net.minecraft.registry.Registry<?>> getRegistries()
      Returns the Registry Map associated with this MutableDynamicRegistryManager.
    • getOptional

      public final <E> Optional<net.minecraft.registry.Registry<E>> getOptional(net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<? extends E>> key)
      Specified by:
      getOptional in interface net.minecraft.registry.DynamicRegistryManager
    • streamAllRegistries

      public final Stream<net.minecraft.registry.DynamicRegistryManager.Entry<?>> streamAllRegistries()
      Specified by:
      streamAllRegistries in interface net.minecraft.registry.DynamicRegistryManager
    • createEntry

      public static <T, R extends net.minecraft.registry.Registry<? extends T>> net.minecraft.registry.DynamicRegistryManager.Entry<T> createEntry(Map.Entry<? extends net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>>,R> entry)
      Creates a DynamicRegistryManager.Entry based on the given parameters.
      Primarily used in streamAllRegistries().
    • createEntry

      public static <T> net.minecraft.registry.DynamicRegistryManager.Entry<T> createEntry(net.minecraft.registry.RegistryKey<? extends net.minecraft.registry.Registry<?>> key, net.minecraft.registry.Registry<?> value)
      Creates a DynamicRegistryManager.Entry based on the given parameters.