Class FuzzyConfig

java.lang.Object
net.xun.lib.common.api.item.fuzzy.FuzzyConfig

public class FuzzyConfig extends Object
Configuration container for FuzzyMatcher settings, defining comparison rules and component filtering behavior. Instances are immutable and use a copy-on-write pattern for fluent configuration.

This class provides granular control over:

  • Durability/enchantment comparisons
  • Count matching strategies
  • Data component filtering modes
  • Item tag requirements
  • Custom validation rules
See Also:
  • Constructor Details

    • FuzzyConfig

      public FuzzyConfig()
  • Method Details

    • withIgnoreDurability

      public FuzzyConfig withIgnoreDurability(boolean value)
      Sets whether durability values should be ignored in comparisons
      Parameters:
      value - true to disable durability checks, false for strict comparison
      Returns:
      New configuration instance with updated setting
    • withIgnoreEnchantments

      public FuzzyConfig withIgnoreEnchantments(boolean value)
      Sets whether enchantments should be ignored in comparisons
      Parameters:
      value - true to disable enchantment checks, false for strict comparison
      Returns:
      New configuration instance with updated setting
    • withCountMode

      public FuzzyConfig withCountMode(FuzzyConfig.CountMode countMode)
      Configures stack count comparison strategy
      Parameters:
      countMode - The count matching strategy to use
      Returns:
      New configuration instance with updated strategy
      See Also:
    • withComponentFilter

      public FuzzyConfig withComponentFilter(FuzzyConfig.FilterMode mode, Set<net.minecraft.core.component.DataComponentType<?>> components)
      Configures data component filtering using specified mode and components
      Parameters:
      mode - Filtering strategy to apply
      components - Set of components to whitelist/blacklist
      Returns:
      New configuration instance with updated filter
      Throws:
      IllegalArgumentException - If empty component set is provided with WHITELIST/BLACKLIST mode
    • addCustomRule

      @Deprecated(since="1.3") public FuzzyConfig addCustomRule(InventoryPredicate rule)
      Deprecated.
      This method is deprecated, see withPredicateFilter(FilterMode, List) for new handling method
    • withPredicateFilter

      public FuzzyConfig withPredicateFilter(FuzzyConfig.FilterMode mode, List<InventoryPredicate> predicates)
      Configures custom predicate filtering using specified mode and predicates.
      Parameters:
      mode - Filtering strategy to apply (WHITELIST or BLACKLIST)
      predicates - List of predicates to include/exclude based on mode
      Returns:
      New configuration instance with updated predicate rules
      Throws:
      IllegalArgumentException - If empty predicate list is provided with WHITELIST/BLACKLIST mode
    • copy

      public FuzzyConfig copy()
      Creates a deep copy of this configuration. Used internally to maintain immutability when modifying settings.
      Returns:
      New independent configuration instance