CrackedPolishedBlackstoneBricksMC / voldeloom

Voldeloom But Weird
MIT License
21 stars 2 forks source link

1.4.7 remapping error #3

Closed Hummel009 closed 1 year ago

Hummel009 commented 1 year ago

Mod works well in the IDE, but crashes in the launcher after compilation.

image image

I used JD GUI and checked, that these methods weren't obfuscated, while the others were.

quat1024 commented 1 year ago

Hey, I feel bad for leaving this issue to sit. Just discovered that my own mod (auto third person version2) was also missing some mappings when built for release. Debugging this is going to be a pain in the ass because in my usual testbed (the sample/1.4.7 folder) remapping seems to work completely fine.

This is the mod in question? https://github.com/Hummel009/The-Rings-of-Power/tree/main/1.4.7 apparently 2.2 reobf is working for you. I did redo most of the mapping system in 2.3. So the bug is there.

Hummel009 commented 1 year ago

Hi! Yes, I first encountered a bug in The Rings of Power mod. Then in another. In any case, version 2.2 works great. Therefore, I want to once again express my gratitude for the only development tool on the Internet that works on the old version.

Perhaps my observations will be useful to correct the error. In general, I paid attention to the fact that mostly non-static methods of classes are not obfuscated. There were no problems with fields and classes. With a couple of non-static methods as well. So I was able to fix everything and run with a few simple reflection methods with obfuscated field names.

quat1024 commented 1 year ago

Hmm... i added this to my buildscript and it seemed to fix things:

volde {
    forgeCapabilities {
        srgsAsFallback = true
    }
}

This srgsAsFallback feature is supposed to control what happens when a field/method doesn't have an assigned MCP name (for example, net.minecraft.client.multiplayer.PlayerControllerMP#func_78768_b in 1.4.7). Evidently it is not working right, and is breaking unrelated mappings if you turn it off

quat1024 commented 1 year ago

Think I figured it out. When computing the reobf mappings, if you didn't have srgsAsFallback enabled I was computing the wrong method descriptor.

The correct reobf mapping:

MD: net/minecraft/entity/Entity/isInsideOfMaterial (Lnet/minecraft/block/material/Material;)Z lq/a (Lagi;)Z

The incorrect one:

MD: net/minecraft/entity/Entity/isInsideOfMaterial (Lagi;)Z lq/a (Lagi;)Z

It's true that net/minecraft/block/material/Material corresponds to the obfuscated class agi, but the left side of the mappings is supposed to represent how the method call looks in the unobfuscated jar. Of course you call the method passing a Material instead of an agi in the unobfuscated code. So the issue affected every call to a method that used a class from Minecraft in its argument list, or its return type.

quat1024 commented 1 year ago

Ok, this should be all fixed in version 2.4.

That version also removes the srgsAsFallback option (it's effectively always set to true) because it's kind of useless.