Class AutoLoaded<T>
java.lang.Object
dev.jaxydog.lodestone.api.AutoLoaded<T>
- Type Parameters:
T- The type of the value stored within this class.
- All Implemented Interfaces:
Loaded
A generic class that wraps a value of type
T, providing a simple interface for applying arbitrary load
methods to generic values. This is typically used alongside an AutoLoader class.
The inner value can be retrieved using the getValue() method.
- Since:
- 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA method run during loading, used with aAutoLoadedwrapper. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe inner list of loading methods. -
Constructor Summary
ConstructorsConstructorDescriptionAutoLoaded(net.minecraft.util.Identifier loaderId, T value) Creates a newAutoLoadedvalue. -
Method Summary
Modifier and TypeMethodDescriptionfinal net.minecraft.util.IdentifierReturns this value's associated identifier, typically used during the automatic loading process.final TgetValue()Returns this wrapper's inner value.final AutoLoaded<T> on(Class<? extends Loaded> type, AutoLoaded.LoadMethod<T> method) Adds a method that will be run within the specifiedLoadedinterface.
-
Field Details
-
loadMethods
-
-
Constructor Details
-
AutoLoaded
Creates a newAutoLoadedvalue.- Parameters:
loaderId- The loaderIdentifier.value- The inner value.- Throws:
NullPointerException- If the given value is null.- Since:
- 1.8.0
-
-
Method Details
-
getValue
Returns this wrapper's inner value.- Returns:
- The inner value.
- Since:
- 1.8.0
-
on
public final AutoLoaded<T> on(Class<? extends Loaded> type, AutoLoaded.LoadMethod<T> method) throws NullPointerException Adds a method that will be run within the specifiedLoadedinterface.- Parameters:
type- TheLoadedinterface.method- The method to run.- Returns:
- This value.
- Throws:
NullPointerException- If either theLoadedinterface or the given method are null.- Since:
- 1.8.0
-
getLoaderId
public final net.minecraft.util.Identifier getLoaderId()Description copied from interface:LoadedReturns this value's associated identifier, typically used during the automatic loading process.- Specified by:
getLoaderIdin interfaceLoaded- Returns:
- This value's associated identifier.
-