Package net.minecraftforge.registries
Class RegistryDelegate<T>
- java.lang.Object
-
- net.minecraftforge.registries.RegistryDelegate<T>
-
- All Implemented Interfaces:
java.util.function.Supplier<T>
,IRegistryDelegate<T>
final class RegistryDelegate<T> extends java.lang.Object implements IRegistryDelegate<T>
-
-
Constructor Summary
Constructors Constructor Description RegistryDelegate(T referent, java.lang.Class<T> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
changeReference(T newTarget)
boolean
equals(java.lang.Object obj)
T
get()
Get the referent pointed at by this delegate.int
hashCode()
ResourceLocation
name()
Get the unique resource location for this delegate.void
setName(ResourceLocation name)
java.lang.Class<T>
type()
Get the delegate type.
-
-
-
Field Detail
-
referent
private T referent
-
name
private ResourceLocation name
-
type
private final 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 interfaceIRegistryDelegate<T>
- Specified by:
get
in interfacejava.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 interfaceIRegistryDelegate<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 interfaceIRegistryDelegate<T>
- Returns:
- The type of delegate
-
changeReference
void changeReference(T newTarget)
-
setName
public void setName(ResourceLocation name)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-