Jump to content

Recommended Posts

Posted

I tried to update my mod from 1.6.4 where I used Java Reflection to access the protected field GuiScreen.buttonList

to 1.7.2 where I decided to switch to access transformers for performance (and compatibility)

 

I added a *_at.cfg to ressources folder and re-setup the gradlew stuff and now in the eclipse environment everything works fine and everything is public :)

 

But when I built the jar and tried running it in a not-dev-environment (normal minecraft) I get this error:

java.lang.IllegalAccessError: tried to access field net.minecraft.client.gui.GuiScreen.field_146292_n from class tennox.customselectionbox.CSBClientProxy
at tennox.customselectionbox.CSBClientProxy.onTick(CSBClientProxy.java:31)

 

 

 

Edit:

tennox_customselectionbox_at.cfg:

public net.minecraft.client.gui.GuiScreen *

Posted

Do you have your Coremod stuff setup? (IFMLLoadingPlugin and the like?)

 

I have to admit I did forget that... (Will try with that, but if Access Transformers aren't better, I would like to try with reflection)

But to the reflection stuff: It works fine in the decompiled environment, but when build I get this error:

[17:46:06 INFO]: Client> java.lang.NoSuchFieldException: buttonList
[17:46:06 INFO]: Client> 	at java.lang.Class.getDeclaredField(Unknown Source)

 

My Code:

Field field = guioptions.getClass().getSuperclass().getDeclaredField("buttonList");
field.setAccessible(true);
List buttons = field.get(guioptions)

 

I thought Minecraft is decompiled at runtime? Also it said in the Wiki (http://www.minecraftforge.net/wiki/Using_Access_Transformers):

the naming convention should be srg names and Forge packages

 

What did I understand wrong here?

Posted

Did you check your *at.cfg file is in your built mod jar ?

You also need your manifest file to point to your IFMLLoadingPlugin.

 

jar {
    // Add Coremod Manifest
    manifest {
        attributes 'FMLCorePlugin': "loadingPlugin.classpath"//to be replaced by the correct classpath
        attributes 'FMLCorePluginContainsFMLMod': true//If you want that too
    }
}

 

Posted

The tutorial is a bit unclear. You still need the coremod stuff, it is what makes the modifications work in the compiled minecraft (for the end-user, outside the development environment).

For your development environment, ForgeGradle applies the modifications directly.

 

Too complicated for what I want, just using Reflection now :)

 

Thanks!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.