Class BuildableInteractionResult
java.lang.Object
com.pixelmonmod.pixelmon.api.npc.interaction.result.BuildableInteractionResult
- All Implemented Interfaces:
InteractionResult
An interaction result that allows you to build it using a
builder pattern. This is useful for easily creating an interaction
result without having to create a new class for it.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder class for creating a custom interaction resultprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.mojang.serialization.Codec<BuildableInteractionResult>protected final BiConsumer<InteractionContext,VariableList> protected final List<BuildableInteractionResult.Variable<?>>Fields inherited from interface com.pixelmonmod.pixelmon.api.npc.interaction.result.InteractionResult
CODEC -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotected -
Method Summary
Modifier and TypeMethodDescriptionprotected BuildableInteractionResultbuilder()Creates a new instance of the builder to create a custom interaction resultcom.mojang.serialization.Codec<BuildableInteractionResult>codec()The coded for decoding data for this interaction resultfill(ResultData data) voidhandle(InteractionContext context) Handles the result using the given contextnewInstance(Object... variables) Creates a copy of this interaction result with the given values set as the instances of the variables.protected <T> voidset(BuildableInteractionResult.Variable<T> variable, Object value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pixelmonmod.pixelmon.api.npc.interaction.result.InteractionResult
canExecute
-
Field Details
-
codec
-
test
-
variables
-
-
Constructor Details
-
BuildableInteractionResult
-
BuildableInteractionResult
-
-
Method Details
-
apply
-
set
-
codec
Description copied from interface:InteractionResultThe coded for decoding data for this interaction result- Specified by:
codecin interfaceInteractionResult- Returns:
- The codec
-
handle
Description copied from interface:InteractionResultHandles the result using the given context- Specified by:
handlein interfaceInteractionResult- Parameters:
context- The context
-
inputTypes
- Specified by:
inputTypesin interfaceInteractionResult
-
fill
- Specified by:
fillin interfaceInteractionResult
-
newInstance
Creates a copy of this interaction result 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 result
-
builder
Creates a new instance of the builder to create a custom interaction result- Returns:
- A new instance of the builder
-