Class BuildableDataProvider<T>
java.lang.Object
com.pixelmonmod.pixelmon.api.npc.interaction.provider.type.BuildableDataProvider<T>
- Type Parameters:
T
- The type of the data provider
- All Implemented Interfaces:
DataProvider<T>
A data provider that allows you to build it using a
builder pattern. This is useful for easily creating a data
provider without having to create a new class for it.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder class for creating a custom data providerprotected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final com.mojang.serialization.Codec<BuildableDataProvider<T>>
protected final BiFunction<InteractionContext,
VariableList, T> protected final List<BuildableDataProvider.Variable<?>>
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
BuildableDataProvider
(BuildableDataProvider<T> original) -
Method Summary
Modifier and TypeMethodDescriptionprotected BuildableDataProvider<T>
static <T> BuildableDataProvider.Builder<T>
builder()
Creates a new instance of the builder to create a custom data providercom.mojang.serialization.Codec<BuildableDataProvider<T>>
codec()
get
(InteractionContext context) newInstance
(Object... variables) Creates a copy of this interaction condition with the given values set as the instances of the variables.protected <A> void
set
(BuildableDataProvider.Variable<A> variable, Object value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.pixelmonmod.pixelmon.api.npc.interaction.provider.DataProvider
getKey
-
Field Details
-
codec
-
converter
-
variables
-
-
Constructor Details
-
BuildableDataProvider
-
BuildableDataProvider
-
-
Method Details
-
apply
-
set
-
codec
- Specified by:
codec
in interfaceDataProvider<T>
-
get
- Specified by:
get
in interfaceDataProvider<T>
-
inputTypes
- Specified by:
inputTypes
in interfaceDataProvider<T>
-
fill
- Specified by:
fill
in interfaceDataProvider<T>
-
newInstance
Creates a copy of this interaction condition with the given values set as the instances of the variables.
Notes:
- You must provide the correct amount of variables otherwise this will throw anIllegalArgumentException
.
- You must provide the variables in the same order as they were provided in the builder.
- You must provide the correct type of variables otherwise this will throw aClassCastException
.- Parameters:
variables
- The variables to set- Returns:
- The new instance of the interaction condition
-
builder
Creates a new instance of the builder to create a custom data provider- Returns:
- A new instance of the builder
-