Skip to content

Conversation

@WolfyScript
Copy link
Owner

@WolfyScript WolfyScript commented Oct 13, 2023

The old APIReferences got a bit clunky:

  • 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 Spigot Impl. of the ItemStackConfig & Better ItemReferences #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:

  • Replace all occurrences where CustomItems are used as references with StackReferences
  • Implement conversion methods between CustomItems and StackReferences
    • CustomItem ⇾ StackReference
    • StackReference ⇾ CustomItem
    • StackReference ⇾ APIReference
    • APIReference ⇾ StackReference
  • Provide similar functionality for StackReferences as CustomItems
    • Check for ItemStack similarity
    • Shrink ItemStacks
    • Permission check
  • Implement StackIdentifier for all the supported Third-Party plugins
    • Including conversion implementation to the old APIReferences

@WolfyScript WolfyScript self-assigned this Oct 13, 2023
@WolfyScript WolfyScript added the enhancement New feature or request label Oct 13, 2023
* Use player to construct ExecutableItems/Blocks if available in context
* Add ItemCreateContext.Builder
@WolfyScript WolfyScript marked this pull request as ready for review October 29, 2023 18:51
# Conflicts:
#	buildSrc/src/main/kotlin/com.wolfyscript.wolfyutils.spigot.java-conventions.gradle.kts
@WolfyScript WolfyScript merged commit 399ae9b into master Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants