Skip to content

Cardinal Components Item

Pyrofab edited this page Jul 23, 2020 · 14 revisions

This module allows mods to attach components to item stacks. Item components are automatically synchronized with the stack they are attached to, and are copied whenever the stack's NBT is copied (notably in some recipes). They are also factored in the results of all ItemStack equality methods that consider NBT - for this reason, component implementations that get attached to item stacks must define a meaningful equals method!

Vanilla Alternative: Stack NBT

+ No dependency
+ No setup required, readily available on every stack
= Automatically synchronized
- Requires a mixin to add data to every created stack
- Must be (de)serialized for every use (can be slow)
- Can only carry raw public data, no private fields, no methods, no interface implementing