tterrag1098 / BON2

A rewrite for Immibis's bearded-octo-nemesis for ForgeGradle
GNU Lesser General Public License v3.0
182 stars 50 forks source link

Major refactor and code clean, as well as introducing Official Mappings and obf->mapped support. #48

Open LexManos opened 5 years ago

LexManos commented 5 years ago

So, this is a fairly big rewrite/refactor. Updated gradle Updated dependencies Removed a bunch of unneeded deps (trove, guava, apache) saves 6MB in the fat jar. Updated to maven publish plugin for gradle. Added sources jar to published artifacts Added 'Minecraft' dropdown and download buttons to the main menu, this will download MCP/MCPConfig so we have access to the SRG files. Massive amounts of deadcode cleanup/removal. Data Objects now have a central static management class {MappingsVersions/MinecraftVersions/MCPVersions} Allow downloading of everything above for both CLI and in GUI.

Anyways, I started poking this because I wanted to convert some notch named jars to MCP mappings. But turns out this project doesnt do that. It ONLY does SRG->MCP names in a very basic way...

Perhaps someone who cares could come along and expand the actual remapping to be intelegent and do full SRG remappings.

LexManos commented 5 years ago

Alright, so added full SRG remapping. You can now remap OBF -> MCP.

Barteks2x commented 5 years ago

Does that change the way srg->mcp is done? This may actually break one of the major use cases I have for BON2. Remapping mods that use mixin from srg to mcp relied on the simpler way of remapping.

Mixin classes generally can contain methods with SRG names that (currently) need to be remapped for mixin to work (I think it is considered a mixin bug bit it's not fixed yet), but if inheritance is taken into account, they won't be remapped, because the mixin class isn't the class that normally contains the srg name (and this is also why runtime remapping in 1.12.x doesn't handle it)

LexManos commented 5 years ago

It does srg->mcp after obf -> srg https://github.com/tterrag1098/BON2/pull/48/files#diff-9b833ebdfffbacc08dc9602f1f9314e8R34

Anora commented 4 years ago

would love to see mappings for ever older versions

LexManos commented 4 years ago

Official mappings are only avalible for versions Mojang releases. As for MCP Mappings, that data may of been lost, but if people submit it we could include it. See the https://github.com/MinecraftForge/MCPConfig project for the obf->srg mappings. And MCPBot for Srg->Mapped names.

As for this PR in general, no idea if it'll ever be uptaken, but feel free to clone my fork and build yourself.

bloodmc commented 3 years ago

I just tested this and ran into 2 issues

  1. BON2 failed to remap the following line in Mekanism's jar

https://github.com/mekanism/Mekanism/blob/1.16.x/src/main/java/mekanism/common/util/MekanismUtils.java#L72

With the original jar containing the SRG mapping

DIRECTION_CODEC = IStringSerializable.createEnumCodec((Supplier)Direction::values, (Function)Direction::func_176739_a);

MCPBot reports

MC 1.16.5: net/minecraft/util/Direction.byName
Name: a => func_176739_a => byName
Comment: Get the facing specified by the given name
Side: BOTH
AT: public net.minecraft.util.Direction func_176739_a(Ljava/lang/String;)Lnet/minecraft/util/Direction; # byName
  1. The version manifest URL doesn't contain the latest 1.16 versions as stated in issue #52 I resolved this by using another URL then adjusting the downloader.

After fixing the version manifest, I did another test with a few McJtyMods which seemed to load fine in my workspace.

Also, now that Forge is using official mappings, are there tsrg's available for remapping SRG to Official?

LexManos commented 3 years ago

1) It should remap fine.. Lambdas/method handles should be good. Would need a test case/way to reproduce and debug. 2) This is because the bot has not been updated to kick off our page gen now that the servers have moved. Could be fixed in BON by either using the xml directly, or fixed in the bot by kicking the correct files.

As for SRG->Official.. No thats not how this works. Forge is not 'using official' It's still using SRG names for runtime/devetime. It just uses official as if it were a MCPBot export. Which is what this does: https://github.com/LexManos/BON2/commit/4bcf3522db76bc2590797990219e3dd45290e4f8#diff-fc439e3caafda604b0e6d265439166b2fd1c147e6ba71b1bec90cd2c43d5e9c9R96

adamsong commented 3 years ago

The command line options do not work, there is no way to specify official mappings.

Quidney commented 2 years ago

Could not load MCP versions from web, mapping versions may be incomplete.

java.net.UnknownHostException: export.mcpbot.bspk.rs

What do I do?

LexManos commented 2 years ago

Nothing, mcpbot is dead, if someone wants to spend the time updating my fork we could probably publish it. But this PR doesn't seem like this will ever be merged. Next time I need this tool gain, i'll fix my fork. But who knows when that'll be.

Attack8 commented 1 year ago

I compiled it myself and it cannot procces the mappings for newer versions, stating: Failed to read MCPConfig data from: C:\Users_____.gradle\caches\forge_gradle\maven_downloader\de\oceanlabs\mcp\mcp_config\1.18.2\mcp_config-1.18.2.zip Unknown spec: 3 Any ideas on an easy fix?