Class BuildableInteractionResult.Builder
java.lang.Object
com.pixelmonmod.pixelmon.api.npc.interaction.result.BuildableInteractionResult.Builder
- Enclosing class:
BuildableInteractionResult
A builder class for creating a custom interaction result
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates the interaction result
If the function is null, this will throw anIllegalStateException<A,B extends DataProvider<A>>
BuildableInteractionResult.BuilderdataProvider(String name, net.minecraft.network.chat.Component label, Class<A> type, com.mojang.serialization.Codec<B> provider, B defaultValue) Gives aDataProvidervariable to the interaction result.function(BiConsumer<StoredContext, VariableList> function) Sets the function for the interaction result
This cannot be nullprotected <T> InputElementType<InputType<T>> variable(String name, net.minecraft.network.chat.Component label, T defaultValue, com.mojang.serialization.Codec<T> codec) Gives a variable to the interaction result.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
variable
public <T> BuildableInteractionResult.Builder variable(String name, net.minecraft.network.chat.Component label, T defaultValue, com.mojang.serialization.Codec<T> codec) Gives a variable to the interaction result.
Note: You cannot provideDataProvidervariables using this method and must instead use thedataProvider(String, Component, Class, Codec, DataProvider)method otherwise you will get anUnsupportedOperationException.- Type Parameters:
T- The type of the variable- Parameters:
name- The name of the variablelabel- The label of the variabledefaultValue- The default value of the variablecodec- The codec of the variable- Returns:
- The builder
-
inputType
-
dataProvider
public <A,B extends DataProvider<A>> BuildableInteractionResult.Builder dataProvider(String name, net.minecraft.network.chat.Component label, Class<A> type, com.mojang.serialization.Codec<B> provider, B defaultValue) Gives aDataProvidervariable to the interaction result.
Note: You cannot provide non-DataProvidervariables using this and must instead use thevariable(String, Component, Object, Codec)method.- Type Parameters:
A- The type of the variableB- The type of the provider- Parameters:
name- The label of the variablelabel- The label of the variabletype- The type of the variableprovider- The provider of the variable- Returns:
- The builder
-
function
Sets the function for the interaction result
This cannot be null- Parameters:
function- The function for the interaction result- Returns:
- The builder
-
build
Creates the interaction result
If the function is null, this will throw anIllegalStateException- Returns:
- The interaction result
-