Class AbstractInteractionResponseHandler
java.lang.Object
com.minecolonies.api.colony.interactionhandling.AbstractInteractionResponseHandler
- All Implemented Interfaces:
IInteractionResponseHandler,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
ServerCitizenInteraction
public abstract class AbstractInteractionResponseHandler
extends Object
implements IInteractionResponseHandler
The abstract interaction response handler to be extended by the other ones.
-
Constructor Summary
ConstructorsConstructorDescriptionWay to load the response handler.AbstractInteractionResponseHandler(@NotNull net.minecraft.network.chat.Component inquiry, boolean primary, IChatPriority priority, Tuple<net.minecraft.network.chat.Component, net.minecraft.network.chat.Component>... responseTuples) The inquiry of the citizen. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Deserialize the response handler from NBT.net.minecraft.network.chat.ComponentThe inquiry of the GUI to the player.List<net.minecraft.network.chat.Component> Get a list of all possible responses.Get the priority of this interaction response handler.@Nullable net.minecraft.network.chat.ComponentgetResponseResult(net.minecraft.network.chat.Component response) Get possible further interaction from the GUI on response.booleanCheck if this interaction is a primary interaction or secondary interaction.booleanisValid(ICitizenData colony) Check if this response handler is still valid.booleanisVisible(net.minecraft.world.level.Level world) Check if this response handler is still visible for the player.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) Serialize the response handler to NBT.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.interactionhandling.IInteractionResponseHandler
genChildInteractions, getId, getInquiry, getInteractionIcon, getType, onClientResponseTriggered, onClosed, onOpened, onServerResponseTriggered, onWindowOpened, removeParent
-
Constructor Details
-
AbstractInteractionResponseHandler
@SafeVarargs public AbstractInteractionResponseHandler(@NotNull @NotNull net.minecraft.network.chat.Component inquiry, boolean primary, IChatPriority priority, Tuple<net.minecraft.network.chat.Component, net.minecraft.network.chat.Component>... responseTuples) The inquiry of the citizen.- Parameters:
inquiry- the inquiry.primary- if primary inquiry.priority- the priority.responseTuples- optional response options.
-
AbstractInteractionResponseHandler
public AbstractInteractionResponseHandler()Way to load the response handler.
-
-
Method Details
-
getInquiry
public net.minecraft.network.chat.Component getInquiry()Description copied from interface:IInteractionResponseHandlerThe inquiry of the GUI to the player. This is the key for the interaction, functions as id.- Specified by:
getInquiryin interfaceIInteractionResponseHandler- Returns:
- the text inquiry.
-
getResponseResult
@Nullable public @Nullable net.minecraft.network.chat.Component getResponseResult(net.minecraft.network.chat.Component response) Description copied from interface:IInteractionResponseHandlerGet possible further interaction from the GUI on response.- Specified by:
getResponseResultin interfaceIInteractionResponseHandler- Parameters:
response- the response given to the GUI.- Returns:
- an instance of ICitizenInquiry if existent, else null.
-
getPossibleResponses
Description copied from interface:IInteractionResponseHandlerGet a list of all possible responses.- Specified by:
getPossibleResponsesin interfaceIInteractionResponseHandler- Returns:
- a list of the possible responses the player can give..
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) Serialize the response handler to NBT.- Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Returns:
- the serialized data.
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Deserialize the response handler from NBT.- Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
isPrimary
public boolean isPrimary()Description copied from interface:IInteractionResponseHandlerCheck if this interaction is a primary interaction or secondary interaction.- Specified by:
isPrimaryin interfaceIInteractionResponseHandler- Returns:
- true if primary.
-
getPriority
Description copied from interface:IInteractionResponseHandlerGet the priority of this interaction response handler.- Specified by:
getPriorityin interfaceIInteractionResponseHandler- Returns:
- the chat priority.
-
isVisible
public boolean isVisible(net.minecraft.world.level.Level world) Description copied from interface:IInteractionResponseHandlerCheck if this response handler is still visible for the player.- Specified by:
isVisiblein interfaceIInteractionResponseHandler- Parameters:
world- the world this citizen is in.- Returns:
- true if so.
-
isValid
Description copied from interface:IInteractionResponseHandlerCheck if this response handler is still valid.- Specified by:
isValidin interfaceIInteractionResponseHandler- Parameters:
colony- the colony the citizen is in.- Returns:
- true if still valid, else false.
-