EMI

EMI

1M Downloads

ToolTip Context Not Passing Context

fzzyhmstrs opened this issue ยท 1 comments

commented

Checking on the log below from Technici4n, it looks like ItemEmiStack (and maybe elsewhere? Didn't check) uses TooltipContext.DEFAULT in it's tooltip method. This short circuits any possibility of context in the context.

TooltipContext.create(client.world), which takes a nullable param, would build contextual Contexts as needed by users.

return getItemStack().getTooltip(Item.TooltipContext.DEFAULT, client.player, TooltipType.BASIC);

java.lang.NullPointerException: Cannot invoke "net.minecraft.core.HolderLookup$Provider.lookupOrThrow(net.minecraft.resources.ResourceKey)" because the return value of "net.minecraft.world.item.Item$TooltipContext.registries()" is null
    at TRANSFORMER/[email protected]/aztech.modern_industrialization.items.diesel_tools.DieselToolItem.appendHoverText(DieselToolItem.java:134)
    at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.getTooltipLines(ItemStack.java:772)
    at TRANSFORMER/[email protected]+1.21+neoforge/dev.emi.emi.api.stack.ItemEmiStack.getTooltipText(ItemEmiStack.java:162)
    at TRANSFORMER/[email protected]+1.21+neoforge/dev.emi.emi.search.EmiSearch.bake(EmiSearch.java:62)
    at TRANSFORMER/[email protected]+1.21+neoforge/dev.emi.emi.runtime.EmiReloadManager$ReloadWorker.run(EmiReloadManager.java:222)
    at java.base/java.lang.Thread.run(Thread.java:1583)
    ```
commented

This was changed to provide context if possible in 1.1.8