Support for Forge's `Item.getCreatorModId`
SquidDev opened this issue ยท 3 comments
There are some items in the game that, despite being registered under one mod, have variants which come from other mods. For example, enchanted books contain are owned by vanilla Minecraft, but can be enchanted with anything!
In those sorts of cases, the "Mod ID" tooltip is less helpful than it could be, as it only tells you the ID of the original item's mod:
Forge exposes a Item.getCreatorModId
method that items can override to supply a different mod ID - it feels like it's probably worth using this inside the current ItemStack
tooltip mixin, instead of just using the mod ID.
Unfortunately there's no alternative for Fabric - this might be something worth exposing through the API as well?
This is currently actually bit of a design question in EMI, which is should the mod name be representative of the stack's identifier, or some other more vague metric like forge's creator mod id system. It's worth noting that EMI actually supports "additional" mod ids in searching and by default implements it for similar things as forge, i.e. if you search for @modname
, it will show you all the enchanted books for a mod. Either way, this is a reasonable issue to leave open while it continues to be mulled over, as were it to go through, this should be the bit of the Forge API to use.
It's worth noting that EMI actually supports "additional" mod ids in searching
Oh, that is neat! Just to double check, this isn't exposed to the API right now - it looks like this just works with books right now, but want to make sure :).
Personally, I think adding a config option to show the originator mod as a seperate line, or perhaps in brackets, would be the best compromise.
So an example would be:
Enchanted Book
Soulbound
Source: Totally Very Original Enchantments
Minecraft
Or a Potion for example, with the bracket idea:
Lingering Potion of Mild Discomfort
Mild Discomfort (0:11)
Minecraft (Alchemy Made Inconvienient)
This way instead of picking and choosing which is shown, both can be shown for clarity.
Could even make it require holding down a key like Shift to see, if you want to avoid cluttering the tooltips.