Record Class ReplacementRequest<T>

java.lang.Object
java.lang.Record
com.blamejared.crafttweaker.api.recipe.replacement.ReplacementRequest<T>
Type Parameters:
T - The type of the object that will undergo replacement.
Record Components:
component - The IRecipeComponent for which this replacer should be carried out.
strategy - The ITargetingStrategy that indicates how the components should be targeted.
target - A Predicate that determines the element that will be targeted for replacement.
replacer - A UnaryOperator that is responsible for performing the actual replacement.

public record ReplacementRequest<T>(IRecipeComponent<T> component, ITargetingStrategy strategy, DescriptivePredicate<T> target, DescriptiveUnaryOperator<T> replacer) extends Record
Indicates a request that needs to be carried out by the Replacer.
Since:
10.0.0
  • Constructor Details

  • Method Details

    • applyRequest

      public boolean applyRequest(IDecomposedRecipe recipe)
      Applies this request to the given IDecomposedRecipe, if possible.

      If the recipe's components do not contain the component() this request is targeting, then replacement fails immediately. Otherwise, a best-effort attempt shall be performed.

      Parameters:
      recipe - The recipe that should undergo replacement.
      Returns:
      Whether the replacement was successful or not.
      Since:
      10.0.0
    • describe

      public String describe()
      Describes this request in a human-readable format for log output.
      Returns:
      A human-readable description.
      Since:
      10.0.0
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • component

      public IRecipeComponent<T> component()
      Returns the value of the component record component.
      Returns:
      the value of the component record component
    • strategy

      public ITargetingStrategy strategy()
      Returns the value of the strategy record component.
      Returns:
      the value of the strategy record component
    • target

      public DescriptivePredicate<T> target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • replacer

      public DescriptiveUnaryOperator<T> replacer()
      Returns the value of the replacer record component.
      Returns:
      the value of the replacer record component