Interface ItemRangeDispatchPredicate
@NonExtendable
public interface ItemRangeDispatchPredicate
Contains factories for often-used "range dispatch" predicates, which check if a value in
ItemPredicateContext is at or above a certain threshold.
Predicates created through these factories support conflict detection and proper sorting when used with custom items. It is as such preferred to use these over custom defined predicates when possible.
- Since:
- 2.9.3
- See Also:
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionbundleFullness(int threshold) Creates a predicate checking the item's bundle fullness (the summed stack count of all the items in a bundle).count(int threshold) Creates a predicate checking the item's stack count.customModelData(@org.checkerframework.checker.index.qual.NonNegative int index, float data) Creates a predicate checking one of the item's custom model data floats.damage(int threshold) Creates a predicate checking the item's damage value.legacyCustomModelData(int data) Creates a predicate checking for the first of the item's custom model data floats, which is the custom model data value on Java servers below 1.21.4.normalizedCount(double threshold) Creates a predicate checking the item's stack count, normalized (count / max_stack_size).normalizedDamage(double threshold) Creates a predicate checking the item's damage value, normalized (damage / max_damage).
-
Method Details
-
bundleFullness
Creates a predicate checking the item's bundle fullness (the summed stack count of all the items in a bundle).Usually used with bundles, but works for any item with the
minecraft:bundle_contentscomponent.- Since:
- 2.9.3
- See Also:
-
damage
Creates a predicate checking the item's damage value.- Since:
- 2.9.3
- See Also:
-
normalizedDamage
Creates a predicate checking the item's damage value, normalized (damage / max_damage). Always returns false ismax_damageis 0.- Since:
- 2.9.3
- See Also:
-
count
Creates a predicate checking the item's stack count.- Since:
- 2.9.3
- See Also:
-
normalizedCount
Creates a predicate checking the item's stack count, normalized (count / max_stack_size).- Since:
- 2.9.3
- See Also:
-
legacyCustomModelData
Creates a predicate checking for the first of the item's custom model data floats, which is the custom model data value on Java servers below 1.21.4.- Since:
- 2.9.3
- See Also:
-
customModelData
static MinecraftPredicate<ItemPredicateContext> customModelData(@org.checkerframework.checker.index.qual.NonNegative int index, float data) Creates a predicate checking one of the item's custom model data floats.- Since:
- 2.9.3
- See Also:
-