Class AbstractInteractionResponseHandler

java.lang.Object
com.minecolonies.api.colony.interactionhandling.AbstractInteractionResponseHandler
All Implemented Interfaces:
IInteractionResponseHandler, net.minecraftforge.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 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: IInteractionResponseHandler
      The inquiry of the GUI to the player. This is the key for the interaction, functions as id.
      Specified by:
      getInquiry in interface IInteractionResponseHandler
      Returns:
      the text inquiry.
    • getResponseResult

      @Nullable public @Nullable net.minecraft.network.chat.Component getResponseResult(net.minecraft.network.chat.Component response)
      Description copied from interface: IInteractionResponseHandler
      Get possible further interaction from the GUI on response.
      Specified by:
      getResponseResult in interface IInteractionResponseHandler
      Parameters:
      response - the response given to the GUI.
      Returns:
      an instance of ICitizenInquiry if existent, else null.
    • getPossibleResponses

      public List<net.minecraft.network.chat.Component> getPossibleResponses()
      Description copied from interface: IInteractionResponseHandler
      Get a list of all possible responses.
      Specified by:
      getPossibleResponses in interface IInteractionResponseHandler
      Returns:
      a list of the possible responses the player can give..
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Serialize the response handler to NBT.
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Returns:
      the serialized data.
    • deserializeNBT

      public void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT)
      Deserialize the response handler from NBT.
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • isPrimary

      public boolean isPrimary()
      Description copied from interface: IInteractionResponseHandler
      Check if this interaction is a primary interaction or secondary interaction.
      Specified by:
      isPrimary in interface IInteractionResponseHandler
      Returns:
      true if primary.
    • getPriority

      public IChatPriority getPriority()
      Description copied from interface: IInteractionResponseHandler
      Get the priority of this interaction response handler.
      Specified by:
      getPriority in interface IInteractionResponseHandler
      Returns:
      the chat priority.
    • isVisible

      public boolean isVisible(net.minecraft.world.level.Level world)
      Description copied from interface: IInteractionResponseHandler
      Check if this response handler is still visible for the player.
      Specified by:
      isVisible in interface IInteractionResponseHandler
      Parameters:
      world - the world this citizen is in.
      Returns:
      true if so.
    • isValid

      public boolean isValid(ICitizenData colony)
      Description copied from interface: IInteractionResponseHandler
      Check if this response handler is still valid.
      Specified by:
      isValid in interface IInteractionResponseHandler
      Parameters:
      colony - the colony the citizen is in.
      Returns:
      true if still valid, else false.