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.

Featured Replies

Posted

Hello,

 

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

 

Example:

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

I can "unmap" EntityItem using this method:

FMLDeobfuscatingRemapper.INSTANCE.map("net/minecraft/entity/item/EntityItem")

 

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?

  • Author

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?

  • Author

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();
	while(methods.hasNext())
	{
		MethodNode m = methods.next();
		if ((m.name.equals(targetMethodName) && m.desc.equals("()V")))
		{
			m.instructions.clear();
			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.

  • Author

I don't know the name, but i used names like a, ai or something like that, but i thought i could use this class "map" these names.

Obviously this is not possible :(.

  • Author

Hm,

what are SRG names?

I used the file 'notch-mcp.srg' in he past

here is one extract:

MD: adw/s_ ()V net/minecraft/entity/item/EntityItem/onUpdate ()V

so i would have to replace onUpdate with s_, that's how i did it in the past.

  • Author

So is there a way to get the notch names?

Also i couldn't get the srg names as well, the only thing i found was mapping func_xxxxxx to onUpdate(), but not the other way round. Did i something wrong?

  • Author

I'm confused, i don't think that i could use srg name ("funcxxxx") instead of ("s_") do transform the class.

MethodNode m = methods.next();
if ((m.name.equals(targetMethodName) && m.desc.equals("()V")))

Therefore i need the notch names ...

 

  • 1 month later...
  • Author

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?

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.