I wish to make a reusable, generic API for adding and accessing additional equipment slots to entities. My initial motivation for this comes from my backpacks (BetterStorage and later Wearable Backpacks), which should really just be able to make use of a "back" slot, ideally. Along with wanting to be able to carry certain other containers à la TerraFirmaCraft.
-
Baubles defines a specific hardcoded set of extra slots: Amulet, head, 2x ring, body, charm, belt. Though I've noticed that some slots get little attention from the other mods, compared to the more popular ring and amulet slots.
On the other hand, sometimes they're not enough - there's other mods that do the same thing as Baubles, offering even more extra equipment slots! -
Curios is an API that was recommended to me, to look at. It appears to solve the problem of hardcoded slots by allowing data packs (which can be part of mods) to define items to fit in any custom slot.
Unfortunately this comes at a great cost: Additional slots are just listed in seemingly arbitrary order in a simple list.
Why not combine these two concepts - hardcoding sensible equipment "regions" with arbitrarily extensible slots, along with a slick (default) user interface?
This is the place on the body of the wearer which an equipment slot is generally associated with. Here are the Vanilla regions with some types of slots that may be used:
- Head: Clothing, Armor, Face
- Chest: Cosmetic, Armor, Clothing
- Legs: Armor, Waist, Clothing
- Feet: Armor, Clothing
Additionally, there will be two new non-Vanilla based regions:
- Back: Quiver, Item (Bow/Weapon/Tool/Shield), Backpack
- Hands: Gloves, Rings
In this list, left-most is also top-most "layer" while right-most is the bottom-most layer, when it comes to rendering.
An equipment region has zero or more slots that have been associated with it. More specific examples:
- Clothing: Hat (above armor), Shirt, Pants, Socks
- Armor: Vanilla armor and more (shoulder armor?)
- Cosmetic: Amulet, Medal, Scarf
- Waist: Belt
Cosmetic slots might be a bit special here as perhaps they should be able to be placed either below or above the armor?
Starting out, perhaps with the exception of the addition of two new slots in the player's survival inventory, there won't be immediately anything noticable.
When the player first picks up an item onto their cursor, they'll either see the "region popup" appear immediately (see screenshot), perhaps with the fitting slot highlighted, or the particular equipment region highlights, followed by the slot when hovering over the region. Only compatible or already occupied custom slots may be shown like this.
Once an item is equipped in a non-default slot, it may be indicated by a small plus icon or similar. Howering over the slot will once again bring up the popup and allows taking out the item.
I believe this would reduce the chances of being annoying, especially by avoiding adding more keybinds, buttons or too many slots to the survival inventory, while still being incredibly usable.
Usability is not everything. Mod compatibility and extensibility is important as well! As such, any custom slot can be used by items! All that is needed would be to add the items to an item tag just like described in Curios such as chest:neck/amulet
for an amulet or head:clothing
for a hat. This could be done through a data pack, so no custom mod is even required.
If available, such an amulet will use a neck/amulet
slot, otherwise it will also accept a neck
slot. This is useful in case there might be too many slots in use otherwise, but might prevent wearing multiple otherwise compatible "neck" items at once.
On the API side of things, slots may be registered to have custom behavior, be disabled by default, or for there to be multiple of them available for items to be placed into (such as rings).
In the future I'd also like to see the possibility of creating a dedicated, modpack-specific equipment interface defined by a .json
file or similar where all slots have a defined position and are always visible, for modpack creators seeking to refine their creation and give it a bit more of a unique feel.
I'm in favor of this! I feel like we'd wanna add various player-related events with mixin to make various bauble effects easier; from the uses of Baubles I can at least think of built-in events for a player tick (probably injected in
updateTurtleHelmet
for sake of organization) and for on a player taking damage. Honestly, I might even make a PR for the equipment tick event to Fabric main.