Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Access Transformers 1.7.10 ['SOLVED' i.e. used reflection instead]

Featured Replies

Posted

Hi

 

Could anyone point me towards a mod on GitHub or similar which uses Access Transformers? (private ->public for a field)

 

I've created an access transformer config file and it worked fine for the dev workspace but when I build to a jar and load it in a release environment, the field is still private.

 

I am about ready to explode trying to get them to work; I am using the FMLAT META-INF method, and FML is loading the rules ok but it just doesn't seem to apply them no matter what combinations I try. 

 

Based on the logs I know it's loading the three rules out of the access transformer file, and they are parsing correctly.  But it seems they are silently not applying.

 

Further information:

If I create a new Forge development environment, place my released mod into the eclipse/mods folder, then debug or run, it applies the access transformation no problem.  (It crashes soon after because all the names are obfuscated, but that's not the point...)

 

Some relevant error logs

 

 

the field I'm trying to modify in KeyBinding is keybindArray (field_74516_a)

@SideOnly(Side.CLIENT)
public class KeyBinding implements Comparable
{
    private static final List keybindArray = new ArrayList();
  ... snip ...

 

my access_transformer file, trying a few different rules

public net.minecraft.client.settings.KeyBinding * # All fields
public net.minecraft.client.settings.KeyBinding field_74516_a # srg name
public net.minecraft.client.settings.KeyBinding keybindArray # deobfs name

 

the error:

cpw.mods.fml.common.LoaderException: java.lang.IllegalAccessError: tried to access field net.minecraft.client.settings.KeyBinding.field_74516_a from class speedytools.clientside.userinput.KeyBindingInterceptor
at cpw.mods.fml.common.LoadController.transition(LoadController.java:162)

 

from fml-client-latest.log with -Dfml.debugAccessTransformer=true

[13:34:14] [main/DEBUG] [FML/]: Examining for coremod candidacy speedytoolsmod-2.0.0.jar
[13:34:14] [main/DEBUG] [FML/]: Loaded 3 rules from AccessTransformer mod jar file C:\Documents and Settings\TGG\My Documents\MineCraft\mods\test\mods\speedytoolsmod-2.0.0.jar

[13:34:14] [main/DEBUG] [FML/]: Not found coremod data in speedytoolsmod-2.0.0.jar
[13:34:14] [main/INFO] [LaunchWrapper/]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker

... snip...

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.audio.SoundCategory (w)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.client.settings.KeyBinding (bal)

[13:34:20] [Client thread/DEBUG] [FML/]: Considering all methods and fields on net.minecraft.util.IntHashMap (pz)

 

from the console output with -Dfml.debugAccessTransformer=true

AT RULE: 0000000000000001 *  (type net.minecraft.client.settings.KeyBinding)
AT RULE: 0000000000000001 field_74516_a  (type net.minecraft.client.settings.KeyBinding)
AT RULE: 0000000000000001 keybindArray  (type net.minecraft.client.settings.KeyBinding)

 

If I create a new Forge development environment, place my released mod into the eclipse/mods folder, then debug or run:

[20:03:17] [Client thread/INFO] [sTDOUT]: [cpw.mods.fml.common.asm.transformers.AccessTransformer:transform:211]: Field: net.minecraft.client.settings.KeyBinding.keybindArray 0000000000011010 -> 0000000000011001

 

 

 

-TGG

 

 

  • Author

Well I've spat the dummy and used Reflection get and set instead.  After a bit more testing I'm reasonably sure it's an FML bug related to (re)obfuscation, but maybe that's just sour grapes talking.

 

Anyway I don't need the access transformers any more.  If you know what went wrong, I'm interested to hear, but don't waste time trying to figure it out for my sake:)

 

-TGG

From the new Forge RB changelog:

Fixed issue in loading non-coremod AccessTransformer files.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.