[WIP] [RFC] Early WIP of extension slot API proof of concept. #1183
+546
−0
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.
Nothing here is final. Even this description is just a braindump.
There have always been mods that extend the player inventory (and sometimes other entities). Usually, though, there was only one popular option for any major version. The situation may be changing.
Here is a very early proposal for what I would like an API that unifies access to these mod's extension slots. It is loosely based on my own code I wrote years ago with the idea of eventually making a PR to forge. https://github.com/gigaherz/ToolBelt/tree/1.20.1/src/main/java/dev/gigaherz/toolbelt/customslots
My use case is that my Tool Belt "finds" the belt slot when opening the GUI, while the gui is open, I require consistent access to the slot (meaning I can check every tick if the belt is still in that slot), and if I actually implemented a feature that has been in my TODO list, I would need to mutate the stack or replace it in the slot. So it would greatly benefit me if we had a shared API for accessing these slots.
I am sure there are many uses cases which I have not yet considered. I am prepared to make any changes necessary for them, or even to make way for someone else's design.
This API has been designed to fulfill these requirements:
The design includes:
Questions I have for the community:
Additional considerations: