Jump to content

FMLDeobfuscatingRemapper unmapping field/method


Recommended Posts



is there a way to "unmap" names of field/ method?



I'm using the "IClassTransformer" and want to edit the 2"onUpdate" ("()V") in "EntityItem".

I can "unmap" EntityItem using this method:



but "unmapping" onUpdate is not possible...

i can only map fields/methods

FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(owner, name, desc);

FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(owner, name, desc);


So my question is:

Is there a way to unmap Fields/Methods?

Link to comment
Share on other sites

The MCP names (onUpdate, onBlockActivated, etc.) are not available at runtime outside the dev environment. All you have access to are the SRG names (field_xxxxx_x, func_xxxxx_x) and you can map between those and the "fully obfuscated names" (the names in the original jar file).

How? I will need that, too :D.

FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(owner, name, desc); doesn't work :(, maybe i'm doing it wrong?


If you only want 1 name in your code you need to use SRG names in the code and translate to MCP names in the development environment. I use this class for that: https://github.com/diesieben07/SevenCommons/blob/master/src/main/java/de/take_weiland/mods/commons/asm/MCPNames.java

You will need to update the path to the mappings files for 1.7 though.

I searched for these two files (fields.csv and methods.csv), but couldn't find it for 1.8 :(.


Also i don't understand these lines:

String prop = System.getProperty(SYS_PROP);
if (prop == null) {
mappingsDir = "./../build/unpacked/mappings/";
} else {
mappingsDir = prop;

Does this also work outside of my eclipse environment?

Link to comment
Share on other sites

but this does only work in m eclipse enviroment:

public void replaceOnUpdateMethod(ClassNode node)
	String targetMethodName = "onUpdate";
	String targetDESC = "(Lnet/minecraft/entity/item/EntityItem;)V";

	Iterator<MethodNode> methods = node.methods.iterator();
		MethodNode m = methods.next();
		if ((m.name.equals(targetMethodName) && m.desc.equals("()V")))
			m.instructions.add(new VarInsnNode(ALOAD, 0));
			m.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/creativemd/itemphysic/physics/ServerPhysic",  "update", targetDESC, false));
			m.instructions.add(new InsnNode(RETURN));

I think because it's not a real "link" to the method, but only a string.

Link to comment
Share on other sites

  • 1 month later...

After a little break, i continued working on it and failed :(

I'm using "@IFMLLoadingPlugin.SortingIndex(1001)"

but there is no way i can map an methodname like "interactFirst" to something like "func....".

I tried everything but couldn't find anything which could help me doing it.

FMLDeobfuscatingRemapper is saving these names in "rawFieldMaps", but there is no way i could access them, also it's only saving the SRG names.

So i don't know if this class is able to find the SRG name for a given MCP name.

Could someone help me out?

Link to comment
Share on other sites

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.

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.

  • Create New...

Important Information

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