PersonTheCat / OreStoneVariants

A powerful utility for generating new blocks when given a foreground and background.
GNU General Public License v3.0
7 stars 8 forks source link

Crash on load (Index Out of Bounds) with version 4.0 and greater. #42

Closed Zarepheth closed 5 years ago

Zarepheth commented 5 years ago

When attempting to use Ore Stone Variants version 4.0 and greater, Minecraft crashes during launch. Rolling back to version 3.9 allows Minecraft to finish loading and the game to work.

Since no one else has reported this issue, did I miss a change in the configuration file format between versions 3.x and 4.x?

Full log here: https://paste.ee/p/1C0sV

Start of stack trace:

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Ore Stone Variants (ore_stone_variants)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at personthecat.mod.objects.blocks.BlockEntry.splitEntry(BlockEntry.java:71)
    at personthecat.mod.config.Cfg.allAllUsed(Cfg.java:799)
    at personthecat.mod.config.Cfg.ensureMissingGroupsAreRegistered(Cfg.java:784)
    at personthecat.mod.config.Cfg.postOrePropertyInit(Cfg.java:686)
    at personthecat.mod.Main.preInit(Main.java:47)
    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.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:624)
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
    at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
    at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
    at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
    at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
    at com.google.common.eventbus.EventBus.post(EventBus.java:217)
PersonTheCat commented 5 years ago

Yeah, I tried pretty hard to make sure everything stayed compatible, but the list is parsed in a totally different way, and then blocks are also registered differently now. OOB exceptions still should never occur, though. In the meantime, if you can send me your config file, I'll be able to figure out where the problem is and maybe even provide a workaround without an update.

Thanks!

Edit: You can also take a look at the 4.0 changelog if you haven't already to get an idea of what's new, of course.

Zarepheth commented 5 years ago

I've attached my config file (adding a ".txt" extension, so GitHub will accept it).

ore_stone_variants.cfg.txt

I'll hunt down the v4.0 change log to see if there's anything obvious for me to manually update.

PersonTheCat commented 5 years ago

Sure thing. So, blank lines aren't really allowed at the moment. That being said, I'll fix this to where you can use them again in 4.3. The other thing you might want to know is that "Disable Ore Names" is no longer an option. That's because all ores are registered directly to the config file now, so it's easier to just remove the ones you don't want. Let me know if you get it working and the new lines aren't added for some reason.

Sorry about that!

Another edit: Just to be clear, blank lines aren't allowed in the variant adder. You just need to remove the extra line in under "Add Ores Here." But I'll definitely fix this in the future.

Zarepheth commented 5 years ago

I’ve seen this file format for many Minecraft mod config files - and maybe elsewhere. It resembles JSON, but would never pass a strict JSON parser. Is there a name and specific syntax for these files? Or does each mod author have to manually code their own config file parser?

PersonTheCat commented 5 years ago

Sorry, I was multitasking as I sent that and didn't really explain it very well. It isn't the config file itself, it's actually just the array "Add Blocks Here." There's a blank line that it's trying to read from, but can't. I had previously accounted for that, but stopped in 4.0. It is definitely a bug and something I will fix by 4.3, but in the meantime, you can work around it by just deleting that extra line.

Zarepheth commented 5 years ago

Removing that blank line in the config file enabled the version 4.2 to work.

PersonTheCat commented 5 years ago

Cool, thanks for the confirmation. I'll leave this open until I get it fixed, hopefully soon.

PersonTheCat commented 5 years ago

Hey, again. Sorry it took me so long to actually do something about this. I just added a check that will avoid empty lines getting processed by the mod, just like things were in previous versions. I'll go ahead and close this issue.