Class ServerCitizenInteraction

java.lang.Object
com.minecolonies.api.colony.interactionhandling.AbstractInteractionResponseHandler
com.minecolonies.core.colony.interactionhandling.ServerCitizenInteraction
All Implemented Interfaces:
IInteractionResponseHandler, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
PosBasedInteraction, RecruitmentInteraction, RequestBasedInteraction, StandardInteraction

public abstract class ServerCitizenInteraction extends AbstractInteractionResponseHandler
The server side interaction response handler.
  • Field Details

    • validatorId

      protected net.minecraft.network.chat.Component validatorId
      The id of the validator.
    • parents

      protected Set<net.minecraft.network.chat.Component> parents
      All registered parents of this response handler.
  • Constructor Details

    • ServerCitizenInteraction

      @SafeVarargs public ServerCitizenInteraction(net.minecraft.network.chat.Component inquiry, boolean primary, IChatPriority priority, Predicate<ICitizenData> validator, net.minecraft.network.chat.Component validatorId, Tuple<net.minecraft.network.chat.Component,net.minecraft.network.chat.Component>... responseTuples)
      The server interaction response handler.
      Parameters:
      inquiry - the client inquiry.
      primary - if primary interaction.
      priority - the interaction priority.
      validator - validation predicate to check if this interaction is still valid.
      validatorId - the id of the validator.
      responseTuples - the tuples mapping player responses to further interactions.
    • ServerCitizenInteraction

      public ServerCitizenInteraction(ICitizen data)
      Way to load the response handler for a citizen.
      Parameters:
      data - the citizen owning this handler.
  • Method Details

    • 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
      Overrides:
      isVisible in class AbstractInteractionResponseHandler
      Parameters:
      world - the world this citizen is in.
      Returns:
      true if so.
    • isValid

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

      public void addParent(net.minecraft.network.chat.Component parent)
      Add a parent to the list.
      Parameters:
      parent - the parent to add.
    • removeParent

      public void removeParent(net.minecraft.network.chat.Component oldParent)
      Remove an old parent and return true if no parent is left.
      Parameters:
      oldParent - the parent to remove.
    • onServerResponseTriggered

      public void onServerResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenData data)
      Description copied from interface: IInteractionResponseHandler
      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

      public boolean onClientResponseTriggered(int responseId, net.minecraft.world.entity.player.Player player, ICitizenDataView data, com.ldtteam.blockui.views.BOWindow window)
      Description copied from interface: IInteractionResponseHandler
      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.
    • serializeNBT

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

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

      protected void loadValidator()
      Load the validator.
    • getId

      public net.minecraft.network.chat.Component getId()
      Description copied from interface: IInteractionResponseHandler
      Get the id.
      Returns:
      the id.