Class FuzzyConfig
java.lang.Object
net.xun.lib.common.api.item.fuzzy.FuzzyConfig
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum defining count comparison strategies:FuzzyConfig.CountMode.IGNORE- Disregards item counts entirelyFuzzyConfig.CountMode.EXACT- Requires identical stack sizesFuzzyConfig.CountMode.AT_LEAST- Requires source count ≥ target countstatic enumEnum defining filtering modes:FuzzyConfig.FilterMode.WHITELIST- Only compare specified objectsFuzzyConfig.FilterMode.BLACKLIST- Compare all objects except specified -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.copy()Creates a deep copy of this configuration.withComponentFilter(FuzzyConfig.FilterMode mode, Set<net.minecraft.core.component.DataComponentType<?>> components) Configures data component filtering using specified mode and componentswithCountMode(FuzzyConfig.CountMode countMode) Configures stack count comparison strategywithIgnoreDurability(boolean value) Sets whether durability values should be ignored in comparisonswithIgnoreEnchantments(boolean value) Sets whether enchantments should be ignored in comparisonswithPredicateFilter(FuzzyConfig.FilterMode mode, List<InventoryPredicate> predicates) Configures custom predicate filtering using specified mode and predicates.
-
Constructor Details
-
FuzzyConfig
public FuzzyConfig()
-
-
Method Details
-
withIgnoreDurability
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
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
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 applycomponents- 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.This method is deprecated, seewithPredicateFilter(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
Creates a deep copy of this configuration. Used internally to maintain immutability when modifying settings.- Returns:
- New independent configuration instance
-
withPredicateFilter(FilterMode, List)for new handling method