They are inflexible when an ItemStack contains properties of multiple plugins.
The parsing of them is global (it is not possible to select a different parser on a per item basis)
The weight and amount are bound to the implementation of the APIReference
These are some parts that the new StackReferences plans to resolve, plus more:
StackReferences and plugin specific implementations are separated.
Weight and Amount are unbound from the implementation.
Parser is no longer bound to the plugin implementation and can be specified on a per-item basis.
ItemStacks will always be stored and can be used as a fallback incase the specified parser fails to find the referenced stack.
The same system that'll be part of the next major v5 update, providing a path for easier migration.
This is a partial rework of #35, and provides better compatibility than the current v5 system, hence it'll be implemented into v5 the same way to replace the current system.
However, since older versions of CustomCrafting very much rely on APIReferences, this update needs to keep backwards compatibility.
APIReferences can be converted into StackReferences, and the other way around.
The old methods and constructors, using APIReferences, still exist and do all the conversions internally.
(And marked as deprecated and for removal!)
New methods and constructors using the StackReferences are added and provide better integration.
To-do:
[x] Replace all occurrences where CustomItems are used as references with StackReferences
[x] Implement conversion methods between CustomItems and StackReferences
[x] CustomItem ⇾ StackReference
[x] StackReference ⇾ CustomItem
[x] StackReference ⇾ APIReference
[x] APIReference ⇾ StackReference
[x] Provide similar functionality for StackReferences as CustomItems
[x] Check for ItemStack similarity
[x] Shrink ItemStacks
[x] Permission check
[x] Implement StackIdentifier for all the supported Third-Party plugins
[x] Including conversion implementation to the old APIReferences
The old APIReferences got a bit clunky:
These are some parts that the new StackReferences plans to resolve, plus more:
This is a partial rework of #35, and provides better compatibility than the current v5 system, hence it'll be implemented into v5 the same way to replace the current system.
However, since older versions of CustomCrafting very much rely on APIReferences, this update needs to keep backwards compatibility.
To-do: