Interface ItemPredicateContext

All Superinterfaces:
MinecraftPredicateContext

@NonExtendable public interface ItemPredicateContext extends MinecraftPredicateContext
Item context. Used for predicates in CustomItemDefinitions.
Since:
2.9.3
  • Method Details

    • count

      int count()
      Returns:
      the stack size
      Since:
      2.9.3
    • maxStackSize

      int maxStackSize()
      Returns:
      the max stack size
      Since:
      2.9.3
    • damage

      int damage()
      Returns:
      the value of the minecraft:damage component, or 0 if not present
      Since:
      2.9.3
    • maxDamage

      int maxDamage()
      Returns:
      the value of the minecraft:max_damage component, or 0 if not present
      Since:
      2.9.3
    • hasFishingRodCast

      boolean hasFishingRodCast()
      Returns:
      if the session player is holding a fishing rod cast
      Since:
      2.9.3
    • unbreakable

      boolean unbreakable()
      Returns:
      true if the minecraft:unbreakable component is present
      Since:
      2.9.3
    • bundleFullness

      float bundleFullness()
      Returns:
      the bundle's fullness from the minecraft:bundle_contents component, or 0 if not present
      Since:
      2.9.3
    • trimMaterial

      @Nullable Identifier trimMaterial()
      Returns:
      the identifier of the item's trim material, or null if no trim is present
      Since:
      2.9.3
    • chargedProjectiles

      List<ChargedProjectile> chargedProjectiles()
      Returns:
      all the charged projectiles in the minecraft:charged_projectiles component
      Since:
      2.9.3
    • components

      List<Identifier> components()
      Returns:
      a list of all the components present on the item, including default components
      Since:
      2.9.3
    • customModelDataFlag

      boolean customModelDataFlag(int index)
      Parameters:
      index - the flag index
      Returns:
      a flag of the item's custom model data, defaults to false
      Since:
      2.9.3
    • customModelDataString

      @Nullable String customModelDataString(int index)
      Parameters:
      index - the string index
      Returns:
      a string of the item's custom model data. Returns null if index is out of range
      Since:
      2.9.3
    • customModelDataFloat

      float customModelDataFloat(int index)
      Parameters:
      index - the float index
      Returns:
      a float of the item's custom model data, defaults to 0.0
      Since:
      2.9.3