Class RequestBasedInteraction
java.lang.Object
com.minecolonies.api.colony.interactionhandling.AbstractInteractionResponseHandler
com.minecolonies.core.colony.interactionhandling.ServerCitizenInteraction
com.minecolonies.core.colony.interactionhandling.RequestBasedInteraction
- All Implemented Interfaces:
IInteractionResponseHandler,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
The request based interaction response handler.
-
Field Summary
Fields inherited from class com.minecolonies.core.colony.interactionhandling.ServerCitizenInteraction
parents, validatorId -
Constructor Summary
ConstructorsConstructorDescriptionWay to load the response handler for a citizen.RequestBasedInteraction(net.minecraft.network.chat.Component inquiry, IChatPriority priority, IToken<?> token) The server interaction response handler.RequestBasedInteraction(net.minecraft.network.chat.Component inquiry, IChatPriority priority, net.minecraft.network.chat.Component validator, IToken<?> token) The server interaction response handler. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(@NotNull net.minecraft.nbt.CompoundTag compoundNBT) Deserialize the response handler from NBT.Gen all child interactions related to this.getType()Type id used to deserialize.booleanisValid(ICitizenData citizen) Check if this response handler is still valid.protected voidLoad the validator.booleanonClientResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenDataView data, com.ldtteam.blockui.views.BOWindow window) Client side action triggered on a possible response.voidonServerResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenData data) Server side action triggered on a possible response.voidonWindowOpened(com.ldtteam.blockui.views.BOWindow window, ICitizenDataView dataView) Callback for showing the interaction, to set interaction specific stuffnet.minecraft.nbt.CompoundTagSerialize the response handler to NBT.Methods inherited from class com.minecolonies.core.colony.interactionhandling.ServerCitizenInteraction
addParent, getId, isVisible, removeParentMethods inherited from class com.minecolonies.api.colony.interactionhandling.AbstractInteractionResponseHandler
getInquiry, getPossibleResponses, getPriority, getResponseResult, isPrimaryMethods 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
getInquiry, getInteractionIcon, onClosed, onOpened
-
Constructor Details
-
RequestBasedInteraction
public RequestBasedInteraction(net.minecraft.network.chat.Component inquiry, IChatPriority priority, net.minecraft.network.chat.Component validator, IToken<?> token) The server interaction response handler.- Parameters:
inquiry- the client inquiry.priority- the interaction priority.token- the token this is related to.validator- the validator id.
-
RequestBasedInteraction
public RequestBasedInteraction(net.minecraft.network.chat.Component inquiry, IChatPriority priority, IToken<?> token) The server interaction response handler.- Parameters:
inquiry- the client inquiry.priority- the interaction priority.token- the token this is related to.
-
RequestBasedInteraction
Way to load the response handler for a citizen.- Parameters:
data- the citizen owning this handler.
-
-
Method Details
-
genChildInteractions
Description copied from interface:IInteractionResponseHandlerGen all child interactions related to this.- Returns:
- all child interactions.
-
isValid
Description copied from interface:IInteractionResponseHandlerCheck if this response handler is still valid.- Specified by:
isValidin interfaceIInteractionResponseHandler- Overrides:
isValidin classServerCitizenInteraction- Parameters:
citizen- the colony the citizen is in.- Returns:
- true if still valid, else false.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()Description copied from class:AbstractInteractionResponseHandlerSerialize the response handler to NBT.- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
serializeNBTin classServerCitizenInteraction- Returns:
- the serialized data.
-
deserializeNBT
public void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Description copied from class:AbstractInteractionResponseHandlerDeserialize the response handler from NBT.- Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classServerCitizenInteraction
-
onWindowOpened
Description copied from interface:IInteractionResponseHandlerCallback for showing the interaction, to set interaction specific stuff -
onClientResponseTriggered
public boolean onClientResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenDataView data, com.ldtteam.blockui.views.BOWindow window) Description copied from interface:IInteractionResponseHandlerClient side action triggered on a possible response.- Specified by:
onClientResponseTriggeredin interfaceIInteractionResponseHandler- Overrides:
onClientResponseTriggeredin classServerCitizenInteraction- Parameters:
responseId- the clicked index.player- the client side world.data- the citizen data assigned to it.window- the window it was triggered in.- Returns:
- if wishing to continue interacting.
-
onServerResponseTriggered
public void onServerResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenData data) Description copied from interface:IInteractionResponseHandlerServer side action triggered on a possible response.- Specified by:
onServerResponseTriggeredin interfaceIInteractionResponseHandler- Overrides:
onServerResponseTriggeredin classServerCitizenInteraction- Parameters:
responseId- the clicked string response of the player.player- the world it was triggered in.data- the citizen related to it.
-
loadValidator
protected void loadValidator()Description copied from class:ServerCitizenInteractionLoad the validator.- Overrides:
loadValidatorin classServerCitizenInteraction
-
getType
Description copied from interface:IInteractionResponseHandlerType id used to deserialize.- Returns:
- the string type.
-