Class ItemComponentUtils

java.lang.Object
ch.njol.skript.bukkitutil.ItemComponentUtils

public class ItemComponentUtils extends Object
Utilily methods to handle DataComponents
  • Constructor Details

    • ItemComponentUtils

      public ItemComponentUtils()
  • Method Details

    • isConsumable

      public static boolean isConsumable(ItemStack item)
      Check if an ItemStack has a consumable component
      Parameters:
      item - ItemStack to check
      Returns:
      True if item has consumable component
    • isFireResistant

      public static boolean isFireResistant(ItemStack item)
      Check if an ItemStack is resistant to fire

      This does not check enchantments, only data component for damage resistance

      Parameters:
      item - ItemStack to check
      Returns:
      True if fire-resistant
    • setFireResistant

      public static void setFireResistant(ItemStack item, boolean resistant)
      Set whether an ItemStack is fire-resistant

      This can override vanilla resistance

      Parameters:
      item - ItemStack to modify
      resistant - Whether fire-resistant or not