MinecraftForge / SrgUtils

A library for working with SRG, and other mapping variants.
GNU Lesser General Public License v2.1
12 stars 16 forks source link

Add filtering and filling capability to MappingFile #3

Closed theWituch closed 3 years ago

theWituch commented 3 years ago

Filtering allows to remove nodes with same original and mapped side from mapping. Filtering checks if node can be removed from mapping without interrupting rest of mapping. Fields and parameters can be always filtered because they can't have children. For classes and methods, they are tested if all children (if present) can be filtered too.

Filling is useful especially when chaining two srgs and base mapping does not cover all of nodes from second - eg. like Bukkit and official Mojang mappings. This is due to the way the mappings are chained - iterations are only performed on the base mapping nodes. After chaining Bukkit to Mojang it can be filled with rest of Mojang nodes. That produces full mapping to convert whole Bukkit project to official names.

LexManos commented 3 years ago

Honestly, this is outside the scope of SRGUtils. The chain/reverse/rename helpers are simple helpers that don't really effect much. This is too complex and niche to be of use in the main lib. You can build your own Mappings just like the internal things do, so you should be fine doing this in your own scripts.