MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
509 stars 437 forks source link

Change replaceArgs to accept Map<String, Collection<?>> #806

Closed sciwhiz12 closed 3 years ago

sciwhiz12 commented 3 years ago

Previously, because of how multimaps worked, a multi-replacement without any values would result in the replacement token (and the prefix) remaining in place. This causes issues if a key was associated with a potentially-empty list, since if the list is empty, the token and prefix remains which certainly causes issues with the program to run.

By changing from a mulitmap to a map of collections, this allows for 'empty inputs', where the key still exists in the map and therefore the replacement token and prefix are removed even if there are no values for that key.

The original multimap method is renamed and made to forward to the new method, to preserve compatibility and to allow for cleaner calls in situtations where the caller guarantees the multi-replacement key will always have at least one value (such as a file input and additional inputs in the form of a set of files).

/cc @SizableShrimp