[1.12.2] IllegalAccessError on startup when adding Bookshelf as a dependency through Gradle
ElenaiDev opened this issue ยท 5 comments
Here's the error
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Bookshelf (bookshelf) Caused by: java.lang.IllegalAccessError: tried to access field net.minecraft.client.resources.I18n.i18nLocale from class net.darkhax.bookshelf.client.RomanNumerals at net.darkhax.bookshelf.client.RomanNumerals.mapLevels(RomanNumerals.java:50) at net.darkhax.bookshelf.client.RomanNumerals.insertRomanNumerals(RomanNumerals.java:43) at net.darkhax.bookshelf.Bookshelf.onLoadComplete(Bookshelf.java:133) 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:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:639) at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197) 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:498) 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) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:757) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) at net.minecraft.client.Minecraft.init(Minecraft.java:535) at net.minecraft.client.Minecraft.run(Minecraft.java:378) at net.minecraft.client.main.Main.main(Main.java:118) 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:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) 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:498) at net.minecraftforge.legacydev.Main.start(Main.java:86) at
net.minecraftforge.legacydev.MainClient.main(MainClient.java:29)`
This looks like the access transformers from Bookshelf are not being applied. How are you defining the dependency in Gradle?
You can refer to Dark Utilities if you need a working example.
Hi there, thank you for your quick reply!
I am simply defining it as so:
repositories {
maven { url 'https://maven.mcmoddev.com' }
}
dependencies {
compile "net.darkhax.bookshelf:Bookshelf-1.12.2:2.3.590"
compile "net.darkhax.gamestages:GameStages-1.12.2:2.0.123"
}
I tried replacing compile with deobfCompile but got the error 'could not find the method deobfCompile()
DoI need to add anything else?
Update on the situation: I've tried adding it as an external Jar through my IDE and I'm still getting the same error.
For now I'm using a somewhat hack method of just manually adding the AT myself, as I feel this issue isn't with your mod, I apologise for bothering you and look forward to using Game Stages in my mod! Thank you for creating such a neat system.
You may need to use deobfProvided
. Item Stages uses both GameStages and Bookshelf in dev fine. Forge ATs definitely have some wonky behavior though.