Interface IInteractionResponseHandler
- All Superinterfaces:
net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- All Known Implementing Classes:
AbstractInteractionResponseHandler,PosBasedInteraction,QuestDeliveryInteraction,QuestDialogueInteraction,RecruitmentInteraction,RequestBasedInteraction,ServerCitizenInteraction,SimpleNotificationInteraction,StandardInteraction
public interface IInteractionResponseHandler
extends net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Response handler for all kind of GUI interactions.
-
Method Summary
Modifier and TypeMethodDescriptionGen all child interactions related to this.net.minecraft.network.chat.ComponentgetId()Get the id.net.minecraft.network.chat.ComponentThe inquiry of the GUI to the player.default net.minecraft.network.chat.ComponentgetInquiry(net.minecraft.world.entity.player.Player player) The inquiry of the GUI to the player.default net.minecraft.resources.ResourceLocationGets the icon to render for this interactionList<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.getType()Type id used to deserialize.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.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.default voidonClosed()Trigger on forcefully closing the interaction.default voidonOpened(net.minecraft.world.entity.player.Player player) Trigger on opening the interaction.voidonServerResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenData data) Server side action triggered on a possible response.default voidonWindowOpened(com.ldtteam.blockui.views.BOWindow window, ICitizenDataView dataView) Callback for showing the interaction, to set interaction specific stuffvoidremoveParent(net.minecraft.network.chat.Component inquiry) Remove a certain parent.Methods inherited from interface net.neoforged.neoforge.common.util.INBTSerializable
deserializeNBT, serializeNBT
-
Method Details
-
getInquiry
net.minecraft.network.chat.Component getInquiry()The inquiry of the GUI to the player. This is the key for the interaction, functions as id.- Returns:
- the text inquiry.
-
getInquiry
default net.minecraft.network.chat.Component getInquiry(net.minecraft.world.entity.player.Player player) The inquiry of the GUI to the player. This is the key for the interaction, functions as id.- Returns:
- the text inquiry.
-
getPossibleResponses
List<net.minecraft.network.chat.Component> getPossibleResponses()Get a list of all possible responses.- Returns:
- a list of the possible responses the player can give..
-
getResponseResult
@Nullable @Nullable net.minecraft.network.chat.Component getResponseResult(net.minecraft.network.chat.Component response) Get possible further interaction from the GUI on response.- Parameters:
response- the response given to the GUI.- Returns:
- an instance of ICitizenInquiry if existent, else null.
-
isPrimary
boolean isPrimary()Check if this interaction is a primary interaction or secondary interaction.- Returns:
- true if primary.
-
getPriority
IChatPriority getPriority()Get the priority of this interaction response handler.- Returns:
- the chat priority.
-
isVisible
boolean isVisible(net.minecraft.world.level.Level world) Check if this response handler is still visible for the player.- Parameters:
world- the world this citizen is in.- Returns:
- true if so.
-
isValid
Check if this response handler is still valid.- Parameters:
colony- the colony the citizen is in.- Returns:
- true if still valid, else false.
-
onServerResponseTriggered
void onServerResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenData data) Server side action triggered on a possible response.- Parameters:
responseId- the clicked string response of the player.player- the world it was triggered in.data- the citizen related to it.
-
onClientResponseTriggered
boolean onClientResponseTriggered(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.- 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.
-
removeParent
void removeParent(net.minecraft.network.chat.Component inquiry) Remove a certain parent.- Parameters:
inquiry- the parent inquiry.
-
genChildInteractions
List<IInteractionResponseHandler> genChildInteractions()Gen all child interactions related to this.- Returns:
- all child interactions.
-
getType
String getType()Type id used to deserialize.- Returns:
- the string type.
-
onWindowOpened
Callback for showing the interaction, to set interaction specific stuff -
getInteractionIcon
default net.minecraft.resources.ResourceLocation getInteractionIcon()Gets the icon to render for this interaction- Returns:
- resourcelocation for icon
-
onClosed
default void onClosed()Trigger on forcefully closing the interaction. -
onOpened
default void onOpened(net.minecraft.world.entity.player.Player player) Trigger on opening the interaction. -
getId
net.minecraft.network.chat.Component getId()Get the id.- Returns:
- the id.
-