Record Class MachineAction.Outcome

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.machine.MachineAction.Outcome
Record Components:
done - whether it did anything (the menu redraws)
used - how much of MachineAction.Click.held the machine took
give - what goes to the player's inventory (dropped at their feet if full)
message - shown to the player (action bar), or null
Enclosing interface:
MachineAction

public static record MachineAction.Outcome(boolean done, long used, @NotNull List<ResourceStack> give, @Nullable net.kyori.adventure.text.Component message) extends Record
What came of an action.
  • Constructor Details

    • Outcome

      public Outcome(boolean done, long used, @NotNull @NotNull List<ResourceStack> give, @Nullable @Nullable net.kyori.adventure.text.Component message)
      Creates an instance of a Outcome record class.
      Parameters:
      done - the value for the done record component
      used - the value for the used record component
      give - the value for the give record component
      message - the value for the message record component
  • Method Details

    • ok

      @NotNull public static @NotNull MachineAction.Outcome ok()
    • used

      @NotNull public static @NotNull MachineAction.Outcome used(long used)
      Took used of the held stack.
    • give

      @NotNull public static @NotNull MachineAction.Outcome give(@NotNull @NotNull ResourceStack... stacks)
      Gives stacks to the player.
    • refused

      @NotNull public static @NotNull MachineAction.Outcome refused(@NotNull @NotNull net.kyori.adventure.text.Component message)
      Did nothing, and tells the player why.
    • nothing

      @NotNull public static @NotNull MachineAction.Outcome nothing()
      Did nothing, silently (e.g. a click on an empty row).
    • withMessage

      @NotNull public @NotNull MachineAction.Outcome withMessage(@Nullable @Nullable net.kyori.adventure.text.Component message)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • done

      public boolean done()
      Returns the value of the done record component.
      Returns:
      the value of the done record component
    • used

      public long used()
      Returns the value of the used record component.
      Returns:
      the value of the used record component
    • give

      @NotNull public @NotNull List<ResourceStack> give()
      Returns the value of the give record component.
      Returns:
      the value of the give record component
    • message

      @Nullable public @Nullable net.kyori.adventure.text.Component message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component