Improve error handling around access widener remapping. Closes #311

dev/0.11
modmuss50 2021-01-21 20:30:08 +00:00
parent d91b722c35
commit 34a9d2316c
1 changed files with 7 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
@ -87,6 +88,12 @@ public class AccessWidenerJarProcessor implements JarProcessor {
//Remap accessWidener if its not named, allows for AE's to be written in intermediary
if (!accessWidener.getNamespace().equals("named")) {
try {
List<String> validNamespaces = loomGradleExtension.getMappingsProvider().getMappings().getMetadata().getNamespaces();
if (!validNamespaces.contains(accessWidener.getNamespace())) {
throw new UnsupportedOperationException(String.format("Access Widener namespace '%s' is not a valid namespace, it must be one of: '%s'", accessWidener.getNamespace(), String.join(", ", validNamespaces)));
}
TinyRemapper tinyRemapper = loomGradleExtension.getMinecraftMappedProvider().getTinyRemapper("official", "named");
tinyRemapper.readClassPath(loomGradleExtension.getMinecraftMappedProvider().getRemapClasspath());