Class InteractionSet

java.lang.Object
com.pixelmonmod.pixelmon.api.npc.interaction.InteractionSet
All Implemented Interfaces:
Iterable<Interaction>

public class InteractionSet extends Object implements Iterable<Interaction>
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<InteractionSet> CODEC
  • Constructor Details

    • InteractionSet

      protected InteractionSet(List<Interaction> interactions)
  • Method Details

    • empty

      public static InteractionSet empty()
      Creates a new empty InteractionSet
      Returns:
      A new empty InteractionSet
    • copy

      public static InteractionSet copy(InteractionSet set)
      Copies the given InteractionSet
      Parameters:
      set - The set to copy
      Returns:
      A new InteractionSet with the same interactions as the given set
    • of

      public static InteractionSet of(Interaction... interactions)
      Creates a new InteractionSet with the given interactions
      Parameters:
      interactions - The interactions to add to the set
      Returns:
      A new InteractionSet with the given interactions
    • of

      public static InteractionSet of(Iterable<Interaction> interactions)
      Creates a new InteractionSet with the given interactions
      Parameters:
      interactions - The interactions to add to the set
      Returns:
      A new InteractionSet with the given interactions
    • from

      @Internal public static InteractionSet from(InteractionSetData data)
    • handleInteraction

      public boolean handleInteraction(InteractionEvent interactionEvent, InteractionContext context)
      Checks that the event should be handled by this NPC, then checks against the relevant conditions and then passes the context to the results if the conditions passed.
      Parameters:
      interactionEvent - The event that triggered this call
      context - The context for the event
      Returns:
      True if the event was a success, the conditions passed, and the results were fired
    • iterator

      @NotNull public @NotNull Iterator<Interaction> iterator()
      Specified by:
      iterator in interface Iterable<Interaction>
    • toData

      public InteractionSetData toData()
    • addNewInteraction

      public void addNewInteraction()