Inventory Support on InventoryViewBuilders #12518
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The end goal of this pull request is to address the need to put Inventory on a view builder during the build process. The goal is to completely replace
HumanEntity#openInvenotry(Inventory)
. and deprecateBukkit#createInventory(InventoryType, ...);
methods.When deciding what approach to take to do this I decided it'd be best to avoid
A. Intrusive insertion of Inventories into builders. (This is because Inventories are supported on only some menus and not others)
B. Adding more inheritance (Adding more inheritance while allowing for a more streamlined builder process also makes implementation and future maintenance a pain).
In this iteration I took the approach to instead add an InventorySupport class that allows for the api consumer to cast their builder and then add the inventory from there.
This is an early iterative draft I will take feedback and things may change a lot in between iterations based on feedback. I've opened it as I want feedback so I can continue to iterate on this API.