Class EnumObjects<E extends Enum<E>,T> 
java.lang.Object
org.moddingx.libx.registration.util.EnumObjects<E,T> 
- Type Parameters:
 E- The type of the enum to use.T- The type of the thing to register.
- All Implemented Interfaces:
 Registerable
@PlainRegisterable
public final class EnumObjects<E extends Enum<E>,T> 
extends Object
implements Registerable
A 
Registerable that registers multiple objects, one for each value of an enum. This is
 done via Registerable.registerAdditional(RegistrationContext, EntryCollector) so
 the enum names will be applied automatically.- 
Nested Class Summary
Nested classes/interfaces inherited from interface org.moddingx.libx.registration.Registerable
Registerable.EntryCollector - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionGets a value for an enum value.random(net.minecraft.util.RandomSource random) Gets a random object from the objects in this EnumObjects.voidregisterAdditional(RegistrationContext ctx, Registerable.EntryCollector builder) Registers additional objects.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.moddingx.libx.registration.Registerable
registerClientAdditional, setupClient, setupCommon 
- 
Constructor Details
- 
EnumObjects
public EnumObjects(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey, Class<E> cls, Function<E, T> factory) Creates a new instance of EnumObjects.- Parameters:
 registryKey- The registry to register to.cls- The class of the enum that is used. The enum must have at least one value.factory- A factory function that creates the objects to be registered.
 
 - 
 - 
Method Details
- 
get
Gets a value for an enum value. - 
random
Gets a random object from the objects in this EnumObjects. - 
registerAdditional
@OverridingMethodsMustInvokeSuper public void registerAdditional(RegistrationContext ctx, Registerable.EntryCollector builder) Description copied from interface:RegisterableRegisters additional objects. Those may beRegisterableas well. These objects will be registered with the id of this object and optionally a name suffix.- Specified by:
 registerAdditionalin interfaceRegisterable
 
 -