Pocket upgrades + JEI
uecasm opened this issue ยท 1 comments
- Minecraft version 1.16.5
- CC: Tweaked version 1.16.4-1.95.2
- JEI version 1.16.4-7.6.0.53
When (in a custom addon mod) a new IPocketUpgrade
is registered with PocketUpgrades.register
, it automatically gets a crafting recipe added, which is visible in JEI (and actually works).
This is presumably thanks to integration.jei.RecipeResolver
.
However, without adding anything else, hovering over the output item in JEI's recipe preview logs this exception:
[Render thread/ERROR] [me.je.gu.in.GuiIngredient/]: Exception when rendering tooltip on 1 pocket_computer_advanced.
java.lang.NullPointerException: null
at mezz.jei.gui.recipes.RecipeLayout.lambda$addOutputSlotTooltip$0(RecipeLayout.java:90) ~[jei-1.16.4-7.6.0.53_mapped_snapshot_20201028-1.16.3.jar:7.6.0.53] {re:classloading}
at mezz.jei.gui.ingredients.GuiIngredient.drawTooltip(GuiIngredient.java:223) ~[jei-1.16.4-7.6.0.53_mapped_snapshot_20201028-1.16.3.jar:7.6.0.53] {re:classloading}
This is caused because RecipeResolver.Shaped
returns null from getId
, which is a @Nonnull
method. It should instead return any placeholder ResourceLocation -- the path doesn't really matter (and it can and probably should be the same for all generated recipes) as long as it's in the "computercraft" namespace.
Oddly, I noticed that CC:T has some generated datapack recipes for its own pocket upgrades as well (which seem redundant -- except that they have the peripheral and computer around the opposite way from the internal recipes). These should be immune to the issue since MC will generate them an id based on the json filename. But, the ones that I can see in JEI do show the problem.
Even more oddly, if I add my own datapack recipe for my own upgrade then I see two recipes in JEI -- one the datapack one without tooltip problems and one the internally generated one with the tooltip issue. I'm not sure why I'm not seeing two of each of the CC:T pocket upgrades as well, though it might be namespace related.
Also, if I use the same code as CC:T to generate datapack recipes for my own upgrades, the resulting recipe files are different from the ones in CC:T's code (they include the nbt upgrade data in the output, which seems better than the committed files).
Did you perhaps forget to re-run runData after updating the generator code?