Class ItemDefaults

java.lang.Object
fr.fidorial.item.ItemDefaults

public final class ItemDefaults extends Object
Per-item defaults, as opposed to what a particular stack patches through its components.
Since:
0.1.0
  • Method Details

    • install

      public static void install(ItemDefaults.Source source)
      Installs the table consulted for items that have no registered override.
      Parameters:
      source - the table to read from; replaces whatever was installed before
    • register

      public static void register(Key item, ItemDefaults.Properties properties)
      Records an item's defaults, taking precedence over the installed source. Use this to declare a custom item, or to override a vanilla one.
      Parameters:
      item - namespaced item identifier
      properties - the defaults to record
    • unregister

      public static boolean unregister(Key item)
      Drops a previously registered override, falling back to the installed source.
      Parameters:
      item - namespaced item identifier
      Returns:
      true when an override was removed
    • isRegistered

      public static boolean isRegistered(Key item)
      Parameters:
      item - namespaced item identifier
      Returns:
      true when this item has registered defaults of its own
    • maxStackSize

      public static int maxStackSize(Key item)
      Parameters:
      item - namespaced item identifier
      Returns:
      how many of this item fit in one slot
    • maxDamage

      public static int maxDamage(Key item)
      Parameters:
      item - namespaced item identifier
      Returns:
      total durability, or 0 when the item cannot break
    • maxStackSize

      public static int maxStackSize(Key item, DataComponentHolder patch)
      Resolves how many fit in one slot: what patch says, and failing that the item's own limit.
      Parameters:
      item - namespaced item identifier
      patch - the stack's components
      Returns:
      how many of this item fit in one slot
      Since:
      0.1.0
    • maxDamage

      public static int maxDamage(Key item, DataComponentHolder patch)
      Resolves total durability: what patch says, and failing that the item's own.
      Parameters:
      item - namespaced item identifier
      patch - the stack's components
      Returns:
      total durability, or 0 when the item cannot break
      Since:
      0.1.0