Class ItemDefaults
java.lang.Object
fr.fidorial.item.ItemDefaults
Per-item defaults, as opposed to what a particular stack patches through its
components.
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAn item's defaults.static interfaceSupplies the defaults of items the server knows about. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinstall(ItemDefaults.Source source) Installs the table consulted for items that have no registered override.static booleanisRegistered(Key item) static intstatic intmaxDamage(Key item, DataComponentHolder patch) Resolves total durability: whatpatchsays, and failing that the item's own.static intmaxStackSize(Key item) static intmaxStackSize(Key item, DataComponentHolder patch) Resolves how many fit in one slot: whatpatchsays, and failing that the item's own limit.static voidregister(Key item, ItemDefaults.Properties properties) Records an item's defaults, taking precedence over the installed source.static booleanunregister(Key item) Drops a previously registered override, falling back to the installed source.
-
Method Details
-
install
Installs the table consulted for items that have no registered override.- Parameters:
source- the table to read from; replaces whatever was installed before
-
register
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 identifierproperties- the defaults to record
-
unregister
Drops a previously registered override, falling back to the installed source.- Parameters:
item- namespaced item identifier- Returns:
truewhen an override was removed
-
isRegistered
- Parameters:
item- namespaced item identifier- Returns:
truewhen this item has registered defaults of its own
-
maxStackSize
- Parameters:
item- namespaced item identifier- Returns:
- how many of this item fit in one slot
-
maxDamage
- Parameters:
item- namespaced item identifier- Returns:
- total durability, or
0when the item cannot break
-
maxStackSize
Resolves how many fit in one slot: whatpatchsays, and failing that the item's own limit.- Parameters:
item- namespaced item identifierpatch- the stack's components- Returns:
- how many of this item fit in one slot
- Since:
- 0.1.0
-
maxDamage
Resolves total durability: whatpatchsays, and failing that the item's own.- Parameters:
item- namespaced item identifierpatch- the stack's components- Returns:
- total durability, or
0when the item cannot break - Since:
- 0.1.0
-