Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Already building!" caused by Forge using FontRender.charWidth #438

Closed
Zarepheth opened this issue Jan 25, 2017 · 18 comments
Closed
Labels

Comments

@Zarepheth
Copy link

When both "Just Enough Items" (JEI) and "Optifine" mods are loaded, attempting to open any User Interface window (Inventory, Chest, or device UI's from other mods) will cause the game to crash.

crash-2017-01-24_23.48.00-client.txt

java.lang.IllegalStateException: Already building!
	at net.minecraft.client.renderer.VertexBuffer.func_181668_a(VertexBuffer.java:291)
	at net.minecraft.client.shader.Framebuffer.func_178038_a(Framebuffer.java:264)
	at net.minecraft.client.shader.Framebuffer.func_147615_c(Framebuffer.java:229)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1104)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:372)
	at net.minecraft.client.main.Main.main(SourceFile:124)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

I've already reported the issue with the JEI authors at: mezz/JustEnoughItems#706

Personally, I suspect one of my many other mods has a model that is not rendering correctly in the UI screens or more likely it is not rendering correctly in the JEI interface which accompanies many UI screens.

@sp614x
Copy link
Owner

sp614x commented Jan 25, 2017

Can you post the game output (error log)?
The real error is shown there.

@aschmois
Copy link

aschmois commented Jan 25, 2017

This is the crash report.
crash-2017-01-25_15.18.34-client.txt

The issue definitely stems from other mods that have invalid entities. But the game doesn't crash without optifine. Note that this issue started with forge version 2223 for 1.11.2.

Related Forge issue: MinecraftForge/MinecraftForge#3328

This is probably the important bit:

[15:18:29] [Client thread/ERROR] [FML/]: Exception caught during firing event net.minecraftforge.client.event.GuiScreenEvent$BackgroundDrawnEvent@33dab1ea:
java.lang.NoSuchFieldError: field_78286_d
	at net.minecraftforge.client.model.SimpleModelFontRenderer.func_78266_a(SimpleModelFontRenderer.java:68) ~[SimpleModelFontRenderer.class:?]
	at net.minecraft.client.gui.FontRenderer.func_181559_a(FontRenderer.java:293) ~[bfg.class:?]
	at net.minecraft.client.gui.FontRenderer.func_78255_a(FontRenderer.java:562) ~[bfg.class:?]
	at net.minecraft.client.gui.FontRenderer.func_180455_b(FontRenderer.java:675) ~[bfg.class:?]
	at net.minecraft.client.gui.FontRenderer.func_175065_a(FontRenderer.java:420) ~[bfg.class:?]
	at net.minecraft.client.gui.FontRenderer.func_78276_b(FontRenderer.java:399) ~[bfg.class:?]
	at net.minecraftforge.client.model.FancyMissingModel$BakedModel.func_188616_a(FancyMissingModel.java:146) ~[FancyMissingModel$BakedModel.class:?]
	at net.minecraft.client.renderer.RenderItem.func_175045_a(RenderItem.java:168) ~[bvh.class:?]
	at net.minecraft.client.renderer.RenderItem.func_175036_a(RenderItem.java:140) ~[bvh.class:?]
	at mezz.jei.gui.ingredients.GuiIngredientFast.renderItemAndEffectIntoGUI(GuiIngredientFast.java:120) ~[GuiIngredientFast.class:?]
	at mezz.jei.gui.ingredients.GuiIngredientFast.renderItemAndEffectIntoGUI(GuiIngredientFast.java:93) ~[GuiIngredientFast.class:?]
	at mezz.jei.gui.ingredients.GuiIngredientFastList.render(GuiIngredientFastList.java:165) ~[GuiIngredientFastList.class:?]
	at mezz.jei.gui.ItemListOverlayInternal.drawScreen(ItemListOverlayInternal.java:304) ~[ItemListOverlayInternal.class:?]
	at mezz.jei.GuiEventHandler.onDrawBackgroundEventPost(GuiEventHandler.java:89) ~[GuiEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_325_GuiEventHandler_onDrawBackgroundEventPost_BackgroundDrawnEvent.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
	at net.minecraft.client.gui.GuiScreen.func_146276_q_(GuiScreen.java:584) [bho.class:?]
	at net.minecraft.client.gui.inventory.GuiContainer.func_73863_a(GuiContainer.java:73) [big.class:?]
	at net.minecraft.client.renderer.InventoryEffectRenderer.func_73863_a(InventoryEffectRenderer.java:51) [bir.class:?]
	at net.minecraft.client.gui.inventory.GuiInventory.func_73863_a(SourceFile:47) [bix.class:?]
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:382) [ForgeHooksClient.class:?]
	at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at Reflector.callVoid(Reflector.java:530) [Reflector.class:?]
	at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1414) [bqe.class:?]
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1077) [bes.class:?]
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:372) [bes.class:?]
	at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
[15:18:29] [Client thread/ERROR] [FML/]: Index: 1 Listeners:
[15:18:29] [Client thread/ERROR] [FML/]: 0: NORMAL
[15:18:29] [Client thread/ERROR] [FML/]: 1: ASM: mezz.jei.GuiEventHandler@63a8878e onDrawBackgroundEventPost(Lnet/minecraftforge/client/event/GuiScreenEvent$BackgroundDrawnEvent;)V
[15:18:32] [Client thread/INFO] [journeymap/]: Mapping halted in C:\Users\Andres Schmois\AppData\Roaming\Minecraft\1.11.2\1\journeymap\data\mp\Minecraft~Server\DIM0
[15:18:35] [Client thread/INFO] [STDOUT/]: [net.minecraft.init.Bootstrap:func_179870_a:523]: ---- Minecraft Crash Report ----

@kzintiwife
Copy link

i am seeing the same issue -- but only when trying to search for something in JEI.

crash-2017-01-25_16.54.19-client.txt

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

@kzintiwife The "Already building!" crash is not the real crash. It is a side effect of another crash which has been suppressed. The details of the real crash are shown in the game output (error log).
The "Already building!" is a blanket crash that may have many different causes and it can not be generalized.

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

The SimpleModelFontRenderer is acessing the private field "charWidth" of FontRenderer:
https://github.com/MinecraftForge/MinecraftForge/blob/1.11.x/src/main/java/net/minecraftforge/client/model/SimpleModelFontRenderer.java#L68
OptiFine changes the private field "charWidth" because it is private and no one should be seeing it.
Forge is probably changing the visibility of the fields with access transformer (aaaargh!) and then using them.

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

Forge should use FontRenderer.getCharWidth(char) like everyone else and not abuse AT for accessing private fields. Blame @RainWarrior.

@RainWarrior
Copy link

renderDefaultChar is using the array, because index decoding is already done where it's called (renderChar), so the subclass is using the field too. I don't see a trivial fix, but I'll look into it.
Yes, nobody should be accessing private fields, but me accessing the field is not worse than you removing it. It just means we need to work something out that works for both of us.

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

OptiFine changes it to float[] to properly support HD Fonts and the reobfuscation does not recognize it because of the changed signature. I could add a new "float[] charWidthFloat" and keep the old charWidth with rounded values for background compatibility, but that would be a hack.
I rely on the forge patches being the only thing that is changed in the vanilla classes so I can work around the changes. The AT and ASM code injection throw any reasoning about the code out of the window.

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

The index decoding is straightforward (one indexof and several compares) so it should be much faster than the OpenGL call later.

@sp614x sp614x changed the title Suffering Error: "java.lang.IllegalStateException: Already building!" Error: "Already building!" caused by Forge accessing FontRender.charWidth Jan 26, 2017
@sp614x sp614x changed the title Error: "Already building!" caused by Forge accessing FontRender.charWidth Error: "Already building!" caused by Forge using FontRender.charWidth Jan 26, 2017
@sp614x sp614x added the forge label Jan 26, 2017
@kzintiwife
Copy link

as a work around for the time being - can users turn off custom fonts and it will work?

@sp614x
Copy link
Owner

sp614x commented Jan 26, 2017

Turning Custom Fonts OFF is not going to help. Either Forge or OptiFine has to be changed to work differently.

@aschmois
Copy link

Are there any news on this? I guess I could hide the broken items but I would like to know when they get fixed. At least a config option to disable HD font bytecode modification might work out better? If a PR for Forge is required I can take a crack at it.

@Zarepheth
Copy link
Author

I haven't heard anything recently, but backing down to Forge 2220 allows me to continue playing with Optifine and JEI both installed. However, I also had to downgrade a few other mods that wanted newer versions of Forge. :(

@sp614x
Copy link
Owner

sp614x commented Jan 31, 2017

I could add a workaround if @RainWarrior does not find a solution.

@sp614x
Copy link
Owner

sp614x commented Jan 31, 2017

Updated preview B7 for 1.11.2.
Restored FontRenderer.charWidth to work as vanilla, this should be enough to fix it.

@Zarepheth
Copy link
Author

This seems to fix things when using the B7 preview for MineCraft 1.11.2, Forge 2226, and JEI.

@archonsd
Copy link

Any chance this got (or will get) back ported to 1.10.2 Opti?

@TheSnowyChickens
Copy link

Hello,

after 5 years I found this crash at the first time in 1.12.2 with G6-pre1 with Forge 2860. (+ ~190 mods)

How is the state from this crash ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants