[Feature]: Add option for Display Item to be based on name
Boden-C opened this issue ยท 5 comments
Request Description
There are resource packs that can add icons based on the "renamed name" of the shulker box, like this or this
I think it would be useful for the mod to also support this, maybe as a "tiered" system where it first checks if there is a valid name, if not, then it looks at the content.
This would be useful as sometimes you will set a category shulker box with an icon that isn't present or is not dominant in the shulker box, for example, a "Potion" shulker box that has potion materials or a "Beacon" shulker box that is filled mostly with the beacon base blocks.
This should also fix issue #25
Images
No response
Fabric Version
No response
Additional Context
No response
Thanks for the suggestion! It's a super easy implementation but I've just been way too busy recently to get around to it.
Since there have been significant backend changes for the upcoming 1.20.5 release, I'll be implementing this for that update onwards once I get the chance to work on it further.
Thanks for that pull request.
Some large changes in the MC codebase for this upcoming update, so I expect a lot of it will change but it's a helpful base to go off. (Or I'll get lucky and this mod will be unimpacted by their changes somehow!)
(Or I'll get lucky and this mod will be unimpacted by their changes somehow!)
Yeah, no chance of that lol.
Hey @Boden-C
Just responding to your last comment in #25 here, since it's the more relevant location.
If you used my code, it should match any custom name that contains all the words in the name (think it works with translated since I use the language name)
Specifically, it looks for the item name that has the most amount of matches in the custom name, disregarding plural, other than "shulker" and "bundle"
I saw that but decided to drop back to the standard ID conventions for a couple of reasons:
- Efficiency - I didn't want to loop through every item in the game to find the closest match, for every single shulker visible in the inventory. It's manageable, but still adds unnecessary strain.
- Overlap with other named shulkers - if I name a shulker "Stones", it doesn't always mean that I want it to display the item
minecraft:stone
- I could be referring to any general stones I have around. Sticking to IDs means matching occurs with intention rather than displaying an icon on just any text. - Compatibility with other mods - if there are overlapping item names, I would essentially be picking an arbitrary one to display. Using IDs again makes the display very intentional.
- Efficiency - I didn't want to loop through every item in the game to find the closest match, for every single shulker visible in the inventory. It's manageable, but still adds unnecessary strain.
I was actually concerned about that too but did some benchmarks and didn't see a reliable big change, but it's up to you. Personally, I think having a shulker named minecraft:stone
is a bit weird