joshiejack / Enchiridion

Books mod for minecraft
MIT License
14 stars 16 forks source link

Incompatibility with IE/Enchiridion/Optifine #85

Closed rigerc closed 7 years ago

rigerc commented 8 years ago

I think this is Optifine's doing but I thought I'd open a issue here anyway to make you aware of the problem:

https://github.com/sp614x/optifine/issues/244

joshiejack commented 8 years ago

I wouldn't even know where to begin, since there's zero mention in the log

mrtomwolf commented 8 years ago

Crash log with this issue: http://pastebin.com/RU1R8Kv1

Seems to say nothing but I'm not very good at reading logs.

sp614x commented 7 years ago

The error: [11:57:15] [Client thread/ERROR] [FML/]: Caught exception from immersiveengineering java.lang.StackOverflowError at net.minecraft.client.gui.FontRenderer.func_78263_a(FontRenderer.java:745) ~[bdl.class:?] at blusunrize.immersiveengineering.client.IEItemFontRender.getCharWidthFloat(IEItemFontRender.java:118) ~[IEItemFontRender.class:?] at net.minecraft.client.gui.FontRenderer.func_78263_a(FontRenderer.java:745) ~[bdl.class:?] at blusunrize.immersiveengineering.client.IEItemFontRender.getCharWidthFloat(IEItemFontRender.java:118) ~[IEItemFontRender.class:?] at net.minecraft.client.gui.FontRenderer.func_78263_a(FontRenderer.java:745) ~[bdl.class:?] at blusunrize.immersiveengineering.client.IEItemFontRender.getCharWidthFloat(IEItemFontRender.java:118) ~[IEItemFontRender.class:?] at net.minecraft.client.gui.FontRenderer.func_78263_a(FontRenderer.java:745) ~[bdl.class:?] at blusunrize.immersiveengineering.client.IEItemFontRender.getCharWidthFloat(IEItemFontRender.java:118) ~[IEItemFontRender.class:?]

It looks like IE is patching the FontRenderer to call IEItemFontRender.getCharWidthFloat(), which calls back the original method, which causes an endless loop.

Because IE and OptiFine seem to work, then most probably Enchiridion is also patching FontRenderer and causing the IE patch to generate a wrong code.

Summary:

Because of problems like that, the class patching should be avoided and all base class changes should be delegated to Forge. OptiFine takes care to reflect all base class changes which Forge does and to be compatible with it.

joshiejack commented 7 years ago

My font and ie's font don't interact at all. We're both extending FontRenderer and using our own font instances. Not patching the class. They work fine without optifine.

mrtomwolf commented 7 years ago

Understandable that you can't work around every other mod out there though I'm sad to have to keep Enchiridion disabled. Can't play with this many mods without Optifine and IE just brings more to my world.

You've done a great mod though and next world I make I might go without IE.

sp614x commented 7 years ago

Then the question is why is the IE FontRenderer causing an endless loop only when Enchiridion is added to the mix? If IE is extending the FontRenderer and overriding getCharWidth(), then there is no OptiFine code being called at all and the endless loop is caused only by IE.

sp614x commented 7 years ago

This may be a total coincidence. OptiFine is adding a private method getCharWidthFloat() which is being called at line 745. This is absolutely safe as the private method can not be overriden by a subclass. If IE is extending the class and adding a public method with the same name AND someone else is changing the FontRenderer method signature to public via ASM then the IE method will override the OptiFine method and it will cause the problem exactly as the stack trace shows. Is someone changing the private FontRenderer methods to public via ASM? Forge maybe?

joshiejack commented 7 years ago

That would explain it then. I have all things being made public in my AT. (forgot about that..) I was lazy :P. (As there was a lot of things). I should just change it to the specific things I need access to. (And I know blu has that method name).

joshiejack commented 7 years ago

Confirmed, changing my AT from 4 lines to 23 fixed the issue.

sp614x commented 7 years ago

What a convoluted bug :-)