Class BuildableInteractionCondition.Builder
java.lang.Object
com.pixelmonmod.pixelmon.api.npc.interaction.condition.type.BuildableInteractionCondition.Builder
- Enclosing class:
- BuildableInteractionCondition
A builder class for creating a custom interaction condition
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates the interaction condition
If the test is null, this will throw anIllegalStateException
<A,
B extends DataProvider<A>>
BuildableInteractionCondition.BuilderdataProvider
(String name, net.minecraft.network.chat.Component label, Class<A> type, com.mojang.serialization.Codec<B> provider, B defaultValue) Gives aDataProvider
variable to the interaction condition.protected <T> InputElementType<InputType<T>>
Sets the test for the interaction condition
This cannot be nullvariable
(String name, net.minecraft.network.chat.Component label, T defaultValue, com.mojang.serialization.Codec<T> codec) Gives a variable to the interaction condition.
-
Constructor Details
-
Builder
protected Builder()
-
-
Method Details
-
variable
public <T> BuildableInteractionCondition.Builder variable(String name, net.minecraft.network.chat.Component label, T defaultValue, com.mojang.serialization.Codec<T> codec) Gives a variable to the interaction condition.
Note: You cannot provideDataProvider
variables 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>> BuildableInteractionCondition.Builder dataProvider(String name, net.minecraft.network.chat.Component label, Class<A> type, com.mojang.serialization.Codec<B> provider, B defaultValue) Gives aDataProvider
variable to the interaction condition.
Note: You cannot provide non-DataProvider
variables 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
-
test
public BuildableInteractionCondition.Builder test(BiPredicate<InteractionContext, VariableList> test) Sets the test for the interaction condition
This cannot be null- Parameters:
test
- The test for the interaction condition- Returns:
- The builder
-
build
Creates the interaction condition
If the test is null, this will throw anIllegalStateException
- Returns:
- The interaction condition
-