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
Modifier and TypeClassDescriptionstatic class
A builder class for creating a custom interaction resultprotected static class
-
Field Summary
Modifier 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
ModifierConstructorDescriptionprotected
protected
-
Method Summary
Modifier and TypeMethodDescriptionprotected BuildableInteractionResult
builder()
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) void
handle
(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> void
set
(BuildableInteractionResult.Variable<T> variable, Object value)
-
Field Details
-
codec
-
test
-
variables
-
-
Constructor Details
-
BuildableInteractionResult
-
BuildableInteractionResult
-
-
Method Details
-
apply
-
set
-
codec
Description copied from interface:InteractionResult
The coded for decoding data for this interaction result- Specified by:
codec
in interfaceInteractionResult
- Returns:
- The codec
-
handle
Description copied from interface:InteractionResult
Handles the result using the given context- Specified by:
handle
in interfaceInteractionResult
- Parameters:
context
- The context
-
inputTypes
- Specified by:
inputTypes
in interfaceInteractionResult
-
fill
- Specified by:
fill
in 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
-