joshiejack / Enchiridion

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

[v1.2, MC1.7.10] Crash Before Title Screen When Loading Any Custom Books #7

Closed Eunomiac closed 10 years ago

Eunomiac commented 10 years ago

Whenever I attempt to load a custom book, I get the following crash before the title screen:

Description: Registering texture

java.lang.ArrayIndexOutOfBoundsException: 0
        at net.minecraft.client.renderer.texture.TextureMap.func_110569_e(TextureMap.java:82)
        at net.minecraft.client.renderer.texture.TextureMap.func_110551_a(TextureMap.java:88)
        at net.minecraft.client.renderer.texture.TextureManager.func_110579_a(SourceFile:72)
        at net.minecraft.client.renderer.texture.TextureManager.func_110549_a(SourceFile:136)
        at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110544_b(SourceFile:104)
        at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110541_a(SourceFile:92)
        at net.minecraft.client.Minecraft.func_110436_a(Minecraft.java:606)
        at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303)
        at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:541)
        at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:867)
        at net.minecraft.client.main.Main.main(SourceFile:148)
        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:134)
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Link to Full Crash Log

The crash happens whether I'm using a zipped custom book in the config/books directory, or if I've turned debug mode on and have an .xml file in the config/books/debug folder. According to the Forge log, the XML is "successfully read" by Enchiridion, whether in debug mode or not. As soon as I take the zip file out of the folder (or turn off debug mode), Minecraft loads without issue.

Here is a copy of the book .xml file I'm using, in case the issue is with my code:

<?xml version="1.0"?>
<book>
    <info gen="true">
        <name>Codex HEX</name>
        <author>Grand Architect Eunomiac</author>
        <color>222222</color>
    </info>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: TITLE</text>
    </page>
    <page>
        <text x="0" y="0" italic="true">Text Placeholder: INTRO_BLURB</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: MAP</text>
    </page>
    <page>
        <text x="50" y="-10" bold="true">What is Hex?</text>
        <text x="0" y="17" wrap="200">=Hex Is a Prison=
At Hex's corners, magic binds the six Primal Elementals, safeguarding Creation.  Such powerful magic comes at a cost: Each Primal has one demand that must be met by the Grand Architect, or Hex will fall... as it always has.
=Hex Is a City=
Hex is divided into six Districts, each one unique, defined by its TWO closest Primals.  Deciding what these combinations mean is part of the fun:  Does Fire + Water mean steam and industry, or sunlight and agriculture?</text>
    </page>
    <page>
    <text x="0" y="17" wrap="200">=Hex Is Dynamic=
The Primals cannot sit idle for long.  The Districts provide an outlet, but only when there are things happening!  Hex should be bustling with activity---even when you're not there.
=Hex Is Your Canvas=
Hex is a different kind of "challenge map".  The purpose of Hex is to provide a framework for creative inspiration, and the "rules" exist only to inspire new ways of thinking---if you don't like them, change them (I do)!</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: EARTH</text>
    </page>
    <page>
        <text x="0" y="-5" bold="true">Earth: The Three Labors</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: FIRE</text>
    </page>
    <page>
        <text x="10" y="-10" bold="true">Fire: The Blazing Edict</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: ORDER</text>
    </page>
    <page>
        <text x="10" y="-10" bold="true">Order: The Divine Law</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: AIR</text>
    </page>
    <page>
        <text x="10" y="-10" bold="true">Air: The Celestial Claim</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: WATER</text>
    </page>
    <page>
        <text x="10" y="-10" bold="true">Water: The Æon Decree</text>
    </page>
    <page>
        <text x="30" y="20" bold="true">Img Placeholder: CHAOS</text>
    </page>
    <page>
        <text x="10" y="-10" bold="true">Chaos: The Void Pact</text>
    </page>
</book>
joshiejack commented 10 years ago

I think I understand the issue. Because you are not specifying a custom icon for the book. It's crashing. I forgot to check if an icon was specified or not. I'll release a fix later today.

joshiejack commented 10 years ago

Hmm there appears to be a few more issues. I might need a bit longer to fix them.

joshiejack commented 10 years ago

Oh I see why your book wasn't loading. You are using non standard characters e.g. .Æ Make sure you are saving the XML in UTF-8 encoding format. It looks stupid atm in the default font. Will add a flag to set the text to unicode mode.

joshiejack commented 10 years ago

https://github.com/joshiejack/Enchiridion/commit/a50f750591d18704c5bf768841750a6f43a67f0d

http://minecraft.curseforge.com/mc-mods/76612-enchiridion/files#t1:changelog