Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement StackReferences & Separate CustomItems from external ItemStack references #334

Merged
merged 21 commits into from
Oct 29, 2023

Conversation

WolfyScript
Copy link
Owner

@WolfyScript WolfyScript commented Oct 15, 2023

Previously CustomItems were used both for CustomItems saved via WU, and as references to external Items. That was very confusing and inefficient!
This PR depends on WolfyScript/WolfyUtils-Spigot#66

So now they follow a strict usage:

  • CustomItem represent the custom items saved in WolfyUtils (Stored and Read from registry).
  • StackReferences are used to reference ItemStacks from external or registry sources. They may point to WU CustomItems, Oraxen Items, ItemsAdder Items, etc.
    They do not contain any extra data, other then where the referenced item can be found, or cached values.

This way CustomItems are no longer used everywhere, making it easier to separate functionality, and reducing memory usage, as well as improving performance, because StackReferences are a lot leaner than CustomItems.
No longer does it have the overhead of CustomItems, when initiating simple placeholder items, etc.

To-do:

  • Replace all occurrences where CustomItems are used as references with StackReferences
  • Migrate old CustomItem shrink, similarity, and permission logic to StackReferences

Previously CustomItems were used both for CustomItems saved via WU, and as references to external Items. That was very confusing!
So now they follow a strict usage:
* CustomItem represent the custom items saved in WolfyUtils (Stored and Read from registry).
* StackReferences are used to reference ItemStack/Items from external sources.
 They may point to WU CustomItems, Oraxen Items, ItemsAdder Items, etc.
@WolfyScript WolfyScript self-assigned this Oct 15, 2023
@WolfyScript WolfyScript added the enhancement New feature or request label Oct 15, 2023
* Added various new methods to replace CustomItem usages. Including MergeOption, MergeAdapter, Result, Ingredient, and more
* Deprecated old methods using CustomItems
This may be changed in the future, but for now caching the converted choices is more efficient than converting them each #getChoices call.
These new methods provide better readability.
You can see what the data you put into the Items cache does like edit or create
* And fixed shift+right-click on ingredient/result variants not using the clicked variant
* Swap parser to a different type
* Preview the item of the parser
* Better Edit/Select buttons
@WolfyScript WolfyScript marked this pull request as ready for review October 29, 2023 20:10
@WolfyScript WolfyScript changed the base branch from master to beta October 29, 2023 20:11
@WolfyScript WolfyScript merged commit 1e37490 into beta Oct 29, 2023
1 check failed
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.

None yet

1 participant