Interface ItemConditionPredicate
@NonExtendable
public interface ItemConditionPredicate
Contains often-used predicates and predicate factories for simple conditions for
ItemPredicateContext.
Predicates created through factories here support conflict detection when used with custom items. It is as such preferred to use these over custom defined predicates when possible.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MinecraftPredicate<ItemPredicateContext> Checks if the item is broken (damageable and has 1 durability point left).static final MinecraftPredicate<ItemPredicateContext> Checks if the item is damageable (not unbreakable and has a max damage value above 0).static final MinecraftPredicate<ItemPredicateContext> Checks if the item is damaged (damageable and has a damage value above 0).static final MinecraftPredicate<ItemPredicateContext> Checks if the session player is holding a fishing rod cast.static final MinecraftPredicate<ItemPredicateContext> Checks if the item is unbreakable. -
Method Summary
Static MethodsModifier and TypeMethodDescriptioncustomModelData(@org.checkerframework.checker.index.qual.NonNegative int index) Creates a predicate checking for one of the item's custom model data flags.hasComponent(@NonNull Identifier component) Creates a predicate checking if the item stack has a component with the specified identifier.
-
Field Details
-
UNBREAKABLE
Checks if the item is unbreakable.- See Also:
-
DAMAGEABLE
Checks if the item is damageable (not unbreakable and has a max damage value above 0).- See Also:
-
BROKEN
Checks if the item is broken (damageable and has 1 durability point left).- See Also:
-
DAMAGED
Checks if the item is damaged (damageable and has a damage value above 0).- See Also:
-
FISHING_ROD_CAST
Checks if the session player is holding a fishing rod cast.- See Also:
-
-
Method Details
-
customModelData
static MinecraftPredicate<ItemPredicateContext> customModelData(@org.checkerframework.checker.index.qual.NonNegative int index) Creates a predicate checking for one of the item's custom model data flags.- See Also:
-
hasComponent
Creates a predicate checking if the item stack has a component with the specified identifier.- See Also:
-