Guidebook

Guidebook

6M Downloads

Weirdness and crash caused by chapter skip buttons.

SuperKael opened this issue ยท 8 comments

commented

When using the chapter skip buttons, they always skip to the page after the first page of the chapter, which is strange, but not really a problem. The problem, is that if the chapter skip buttons are used to switch to a blank page represented by a chapter that is locked by a condition, and then skip back again, the game will crash with the following stacktrace:

java.lang.ArrayIndexOutOfBoundsException: -2
	at java.util.ArrayList.elementData(Unknown Source)
	at java.util.ArrayList.get(Unknown Source)
	at gigaherz.guidebook.guidebook.client.BookRendering.drawPage(BookRendering.java:480)
	at gigaherz.guidebook.guidebook.client.BookRendering.drawCurrentPages(BookRendering.java:456)
	at gigaherz.guidebook.guidebook.client.GuiGuidebook.func_73863_a(GuiGuidebook.java:247)
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:368)
	at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1124)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1117)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397)
	at net.minecraft.client.main.Main.main(SourceFile:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

The out-of-bounds array index varies depending on the specific circumstance, but otherwise it's always the same.

EDIT: Further unwitting testing has revealed that the crash is not exclusive to the chapter skip buttons. The regular page switch buttons can cause it too, when viewing blank pages caused by locked chapters.

EDIT 2: Even further testing has shown that, when viewing the locked chapters, the page number changes to '1'. That's... strange. And also, almost certainly related to the crash.

commented

Strange... I'll go through the conditions system logic, there's probably some issue somewhere in the conversion from "section refs" (references that are numbered based on the original book contents), and "page refs" (references that are numbered based on the paginated contents).

commented

I just got another crash, for a slightly different reason. In this case, I had 4 unlocked chapters, and then two locked chapters after them. I unlocked the second of the two locked chapters, but when I tried to switch to it, it abruptly crashed right as it hit the still-locked chapter.

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(Unknown Source)
	at java.util.ArrayList.get(Unknown Source)
	at gigaherz.guidebook.guidebook.client.BookRendering.mouseHover(BookRendering.java:392)
	at gigaherz.guidebook.guidebook.client.GuiGuidebook.func_73863_a(GuiGuidebook.java:254)
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:368)
	at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1124)
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1117)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397)
	at net.minecraft.client.main.Main.main(SourceFile:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Once again though, it clearly relates to chapters locked by conditions.

EDIT: AGH! It crashed this way again, but this time, I had unlocked the previously locked chapter. However, it had not put any pages in it. At this point, should I make a separate issue for this?

commented

No, no need for separate issues, I clearly have issues with the condition system. XD

commented

i updated today and its now when i get the same indexoutofbounds exception, i cant go past the preface and none of the links to other chapters work, so right now the book cant be used at all.
Btw, i made a guide book for my modpack, which may be released next week.

commented

I found a bug that might be the cause, but fixing it is not trivial, I'm still working on it.

commented

okay, anyways there is a config option to not giving the book, when its fixed i set it to true.
Thanks.

commented

v2.8.1 is in review. Hopefully this DOES fix the crashes. I can't make them happen anymore... >_<

commented

2.8.0 is out, and it SHOULD fix the navigation issues. I can't be 100% sure, but they should be fixed. *crosses fingers*