Class IngredientMatcherEnergy

java.lang.Object
org.cyclops.commoncapabilities.ingredient.IngredientMatcherEnergy
All Implemented Interfaces:
Comparator<Long>, IIngredientMatcher<Long,Boolean>

public class IngredientMatcherEnergy extends Object implements IIngredientMatcher<Long,Boolean>
Exact matcher for a void match condition.
  • Constructor Details

    • IngredientMatcherEnergy

      public IngredientMatcherEnergy()
  • Method Details

    • isInstance

      public boolean isInstance(Object object)
      Description copied from interface: IIngredientMatcher
      If the given object is an instance of the ingredient type.
      Specified by:
      isInstance in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      object - An object.
      Returns:
      If the object is a valid instance of the ingredient component type.
    • getAnyMatchCondition

      public Boolean getAnyMatchCondition()
      Specified by:
      getAnyMatchCondition in interface IIngredientMatcher<Long,Boolean>
      Returns:
      The match condition that is used to match any instance based on a prototype.
    • getExactMatchCondition

      public Boolean getExactMatchCondition()
      Specified by:
      getExactMatchCondition in interface IIngredientMatcher<Long,Boolean>
      Returns:
      The match condition that is used to match instances exactly based on a prototype.
    • getExactMatchNoQuantityCondition

      public Boolean getExactMatchNoQuantityCondition()
      Specified by:
      getExactMatchNoQuantityCondition in interface IIngredientMatcher<Long,Boolean>
      Returns:
      The match condition that is used to match instances exactly based on a prototype, excluding the quantity.
    • withCondition

      public Boolean withCondition(Boolean matchCondition, Boolean with)
      Description copied from interface: IIngredientMatcher
      Create a new match condition based on the given condition that includes the second condition.
      Specified by:
      withCondition in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      matchCondition - The match condition to start from.
      with - The match condition to include.
      Returns:
      A new match condition that is the combination of both.
    • withoutCondition

      public Boolean withoutCondition(Boolean matchCondition, Boolean without)
      Description copied from interface: IIngredientMatcher
      Create a new match condition based on the given condition that excludes the second condition.
      Specified by:
      withoutCondition in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      matchCondition - The match condition to start from.
      without - A match condition to exclude.
      Returns:
      A new match condition that is the first one without the second one.
    • hasCondition

      public boolean hasCondition(Boolean matchCondition, Boolean searchCondition)
      Description copied from interface: IIngredientMatcher
      Check if the given match condition contains at least the given condition.
      Specified by:
      hasCondition in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      matchCondition - The match condition to start from.
      searchCondition - A match condition to search for.
      Returns:
      If the first condition contains at least the second condition.
    • matches

      public boolean matches(Long a, Long b, Boolean matchCondition)
      Description copied from interface: IIngredientMatcher
      Check if the two given instances match based on the given match conditions.
      Specified by:
      matches in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      a - A first instance.
      b - A second instance.
      matchCondition - A condition under which the matching should be done.
      Returns:
      If the two given instances match under the given conditions.
    • getEmptyInstance

      public Long getEmptyInstance()
      Specified by:
      getEmptyInstance in interface IIngredientMatcher<Long,Boolean>
      Returns:
      The instance that acts as an 'empty' instance. For ItemStacks, this would be ItemStack.EMPTY.
    • isEmpty

      public boolean isEmpty(Long instance)
      Description copied from interface: IIngredientMatcher
      Check if the given entity matches the empty instance, as provided by IIngredientMatcher.getEmptyInstance().
      Specified by:
      isEmpty in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      If the instance is empty.
    • hash

      public int hash(Long instance)
      Description copied from interface: IIngredientMatcher
      Hash the given instance. This must be calculated quickly.
      Specified by:
      hash in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      A hashcode for the given instance.
    • copy

      public Long copy(Long instance)
      Description copied from interface: IIngredientMatcher
      Create a deep copy of the given instance.
      Specified by:
      copy in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      A copy of the given instance.
    • getQuantity

      public long getQuantity(Long instance)
      Description copied from interface: IIngredientMatcher
      Get the quantity in the given instance.
      Specified by:
      getQuantity in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      The instance quantity.
    • withQuantity

      public Long withQuantity(Long instance, long quantity)
      Description copied from interface: IIngredientMatcher
      Create a copy of the given instance with the given quantity.
      Specified by:
      withQuantity in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      quantity - The new instance quantity.
      Returns:
      The copied instance with the new quantity.
    • getMaximumQuantity

      public long getMaximumQuantity()
      Specified by:
      getMaximumQuantity in interface IIngredientMatcher<Long,Boolean>
      Returns:
      The maximum allowed quantity for instances.
    • conditionCompare

      public int conditionCompare(Boolean a, Boolean b)
      Description copied from interface: IIngredientMatcher
      Compare two conditions with each other.
      Specified by:
      conditionCompare in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      a - A first condition.
      b - A second condition.
      Returns:
      The comparison result.
    • localize

      public String localize(Long instance)
      Description copied from interface: IIngredientMatcher
      Return the localized name of the given instance. This should not include the instance quantity. Should only be called client-side!
      Specified by:
      localize in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      The localized name of the given instance.
    • getDisplayName

      public net.minecraft.network.chat.MutableComponent getDisplayName(Long instance)
      Description copied from interface: IIngredientMatcher
      Return the display name of the given instance. This should not include the instance quantity.
      Specified by:
      getDisplayName in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      The display name of the given instance.
    • toString

      public String toString(Long instance)
      Description copied from interface: IIngredientMatcher
      Return a stringified version of the given instance. These strings are mainly used for development purposes.
      Specified by:
      toString in interface IIngredientMatcher<Long,Boolean>
      Parameters:
      instance - An instance.
      Returns:
      The string version of the given instance.
    • compare

      public int compare(Long o1, Long o2)
      Specified by:
      compare in interface Comparator<Long>