Class RegistryDelegate<T>

  • All Implemented Interfaces:
    java.util.function.Supplier<T>, IRegistryDelegate<T>

    final class RegistryDelegate<T>
    extends java.lang.Object
    implements IRegistryDelegate<T>
    • Field Detail

      • referent

        private T referent
      • type

        private final java.lang.Class<T> type
    • Constructor Detail

      • RegistryDelegate

        public RegistryDelegate​(T referent,
                                java.lang.Class<T> type)
    • Method Detail

      • get

        public T get()
        Description copied from interface: IRegistryDelegate
        Get the referent pointed at by this delegate. This will be the currently active item or block, and will change as world saves come and go. Note that item.delegate.get() may NOT be the same object as item, due to item and block substitution.
        Specified by:
        get in interface IRegistryDelegate<T>
        Specified by:
        get in interface java.util.function.Supplier<T>
        Returns:
        The referred object
      • name

        public ResourceLocation name()
        Description copied from interface: IRegistryDelegate
        Get the unique resource location for this delegate. Completely static after registration has completed, and will never change.
        Specified by:
        name in interface IRegistryDelegate<T>
        Returns:
        The name
      • type

        public java.lang.Class<T> type()
        Description copied from interface: IRegistryDelegate
        Get the delegate type. It will be dependent on the registry this delegate is sourced from.
        Specified by:
        type in interface IRegistryDelegate<T>
        Returns:
        The type of delegate
      • changeReference

        void changeReference​(T newTarget)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object