Improve error handling around access widener remapping. Closes #311
This commit is contained in:
		
							parent
							
								
									d91b722c35
								
							
						
					
					
						commit
						34a9d2316c
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		|  | @ -32,6 +32,7 @@ import java.io.StringWriter; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
| import java.nio.file.Path; | import java.nio.file.Path; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
|  | import java.util.List; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.zip.ZipEntry; | 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 | 		//Remap accessWidener if its not named, allows for AE's to be written in intermediary | ||||||
| 		if (!accessWidener.getNamespace().equals("named")) { | 		if (!accessWidener.getNamespace().equals("named")) { | ||||||
| 			try { | 			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 tinyRemapper = loomGradleExtension.getMinecraftMappedProvider().getTinyRemapper("official", "named"); | ||||||
| 				tinyRemapper.readClassPath(loomGradleExtension.getMinecraftMappedProvider().getRemapClasspath()); | 				tinyRemapper.readClassPath(loomGradleExtension.getMinecraftMappedProvider().getRemapClasspath()); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue