Log spam, resulting from a disabled type check, when browsing recipes in JEI from an open Dimensional Storage GUI
Twisted-Code opened this issue · 5 comments
Describe the bug
I get a certain bit of log spam in the rendering thread whenever I try to browse JEI recipes while I have a dimensional storage open. As far as I can tell (though I really don't consider myself very savvy with Java), it's because of that type check you disabled here. Without that type check, you end up trying to cast every recipe under the sun to net.minecraft.world.item.crafting.CraftingRecipe. Given that even furnace recipes don't seem to support this cast (note the specific line I linked to in the attached log), I'm guessing pretty much any non-crafting-table tab of JEI will cause this exception. Then the failed cast gets spammed into the log by JEI every render thread tick when it tries to update the transfer button. (Strictly speaking I'm not sure why JEI's button needs to update every tick when I've never actually seen it change state while the recipe screen is open to the same tab, but that's probably a question to ask JEI's maintainers, not you)
To Reproduce
Steps to reproduce the behavior:
- Set up a dimensional storage system
- Right click to open its menu.
- In JEI, click the recipe for stone, and switch to the furnace tab
- Watch your log churn away.
Expected behavior
Only cast crafting table recipes to this type
Suggested resolution, but mind you I'm not actually good with Java
Reenable this type check, but make it a bit more inclusive if you are concerned it will miss some recipe types. Does Java have a way to check whether something can cast without resorting to a try-except pattern? If not, maybe build a list/set of know supported types.
Screenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
- Occultism Version: 1.88.0
- OS: Windows 10
- Minecraft Version: 1.19.2
- Modpack Link and Version, or list of mods: ATM 8 1.0.28
Additional context
Here's an example log file. You'll note it got kind of spammy (91 hits for the exception's FQN) even though I tried to only have the furnace recipe tab up for a few seconds:
debug-1.log
Also just want to add while I'm here, I really love the mod, please keep working on it and don't take me as being in any way critical (I was worried I had a critical tone in an early draft of this report). Anyone that can stomach Java's BS on even a semi regular basis has my respect LOL.
Thanks for the report!
I remember there was a reason for disabling the check (it caused issues!) but that may not exist any more on this MC version. Will look into it!
It looks like my check would come too late - the cast fails when casting to CraftingRecipe, which already happens one layer above when Jei's RecipeTransferUtil calls transferRecipe on my handler.
Oddly enough my handler specifies the recipe type as RecipeType RecipeTypes.CRAFTING which really should filter those out. I think I may do something wrong with the registration with jei
EDIT: I think I got it, I was registering a universal recipe transfer handler which apparently ignores the recipe type, there is a registration method to register for a specific type which will probably help!