parent
							
								
									d779225508
								
							
						
					
					
						commit
						52a8f7374e
					
				
					 3 changed files with 32 additions and 44 deletions
				
			
		|  | @ -37,13 +37,12 @@ dependencies { | |||
| 	implementation ('net.fabricmc:stitch:0.1.2.47') { | ||||
| 		exclude module: 'enigma' | ||||
| 	} | ||||
| 	implementation ('net.fabricmc:tiny-remapper:0.1.0.32') { | ||||
| 	implementation ('net.fabricmc:tiny-remapper:0.1.0.29') { | ||||
| 		transitive = false | ||||
| 	} | ||||
| 	implementation ('net.fabricmc:tiny-mappings-parser:0.1.1.8') | ||||
| 	implementation ('org.jetbrains:intellij-fernflower:1.0.0.8') | ||||
| 	implementation ('org.jetbrains:intellij-fernflower:1.0.0.7') | ||||
| 
 | ||||
| 	implementation ('net.fabricmc:sponge-mixin:0.7.11.19') { | ||||
| 	implementation ('net.fabricmc:sponge-mixin:0.7.11.17') { | ||||
| 		exclude module: 'launchwrapper' | ||||
| 		exclude module: 'guava' | ||||
| 	} | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ | |||
| 
 | ||||
| package net.fabricmc.loom.mixin; | ||||
| 
 | ||||
| import net.fabricmc.mappings.*; | ||||
| import net.fabricmc.tinyremapper.TinyUtils; | ||||
| import org.spongepowered.asm.obfuscation.mapping.common.MappingField; | ||||
| import org.spongepowered.asm.obfuscation.mapping.common.MappingMethod; | ||||
| import org.spongepowered.tools.obfuscation.mapping.common.MappingProvider; | ||||
|  | @ -33,7 +33,6 @@ import javax.annotation.processing.Filer; | |||
| import javax.annotation.processing.Messager; | ||||
| import java.io.BufferedReader; | ||||
| import java.io.File; | ||||
| import java.io.FileInputStream; | ||||
| import java.io.IOException; | ||||
| import java.nio.file.Files; | ||||
| 
 | ||||
|  | @ -46,6 +45,16 @@ public class MixinMappingProviderTiny extends MappingProvider { | |||
| 		this.to = to; | ||||
| 	} | ||||
| 
 | ||||
| 	private static String[] removeFirst(String[] src, int count) { | ||||
| 		if (count >= src.length) { | ||||
| 			return new String[0]; | ||||
| 		} else { | ||||
| 			String[] out = new String[src.length - count]; | ||||
| 			System.arraycopy(src, count, out, 0, out.length); | ||||
| 			return out; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public MappingMethod getMethodMapping(MappingMethod method) { | ||||
| 		MappingMethod mapped = this.methodMap.get(method); | ||||
|  | @ -110,34 +119,22 @@ public class MixinMappingProviderTiny extends MappingProvider { | |||
| 		} */ | ||||
| 	} | ||||
| 
 | ||||
| 	// TODO: Unify with tiny-remapper | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void read(File input) throws IOException { | ||||
| 		try (FileInputStream inputStream = new FileInputStream(input)) { | ||||
| 			Mappings mappings = MappingsProvider.readTinyMappings(inputStream, false); | ||||
| 		BufferedReader reader = Files.newBufferedReader(input.toPath()); | ||||
| 
 | ||||
| 			for (ClassEntry entry : mappings.getClassEntries()) { | ||||
| 				classMap.put(entry.get(from), entry.get(to)); | ||||
| 			} | ||||
| 
 | ||||
| 			for (FieldEntry entry : mappings.getFieldEntries()) { | ||||
| 				EntryTriple fromTriple = entry.get(from); | ||||
| 				EntryTriple toTriple = entry.get(to); | ||||
| 
 | ||||
| 				fieldMap.put( | ||||
| 						new MappingField(fromTriple.getOwner(), fromTriple.getName(), fromTriple.getDesc()), | ||||
| 						new MappingField(toTriple.getOwner(), toTriple.getName(), toTriple.getDesc()) | ||||
| 				); | ||||
| 			} | ||||
| 
 | ||||
| 			for (MethodEntry entry : mappings.getMethodEntries()) { | ||||
| 				EntryTriple fromTriple = entry.get(from); | ||||
| 				EntryTriple toTriple = entry.get(to); | ||||
| 				 | ||||
| 				methodMap.put( | ||||
| 						new MappingMethod(fromTriple.getOwner(), fromTriple.getName(), fromTriple.getDesc()), | ||||
| 						new MappingMethod(toTriple.getOwner(), toTriple.getName(), toTriple.getDesc()) | ||||
| 				); | ||||
| 			} | ||||
| 		} | ||||
| 		TinyUtils.read(reader, from, to, classMap::put, (fieldFrom, fieldTo) -> { | ||||
| 			fieldMap.put( | ||||
| 				new MappingField(fieldFrom.owner, fieldFrom.name, fieldFrom.desc), | ||||
| 				new MappingField(fieldTo.owner, fieldTo.name, fieldTo.desc) | ||||
| 			); | ||||
| 		}, (methodFrom, methodTo) -> { | ||||
| 			methodMap.put( | ||||
| 				new MappingMethod(methodFrom.owner, methodFrom.name, methodFrom.desc), | ||||
| 				new MappingMethod(methodTo.owner, methodTo.name, methodTo.desc) | ||||
| 			); | ||||
| 		}); | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -24,7 +24,6 @@ | |||
| 
 | ||||
| package net.fabricmc.loom.task; | ||||
| 
 | ||||
| import net.fabricmc.fernflower.api.IFabricResultSaver; | ||||
| import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler; | ||||
| import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; | ||||
| import org.jetbrains.java.decompiler.main.extern.IBytecodeProvider; | ||||
|  | @ -38,7 +37,7 @@ import java.util.jar.JarEntry; | |||
| import java.util.jar.JarOutputStream; | ||||
| import java.util.jar.Manifest; | ||||
| 
 | ||||
| public class LoomFernflowerDecompiler extends ConsoleDecompiler implements IFabricResultSaver { | ||||
| public class LoomFernflowerDecompiler extends ConsoleDecompiler { | ||||
| 	private final Map<String, int[]> differingMappings = new HashMap<>(); | ||||
| 	private final String jarName; | ||||
| 
 | ||||
|  | @ -84,19 +83,12 @@ public class LoomFernflowerDecompiler extends ConsoleDecompiler implements IFabr | |||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void saveClassEntry(String path, String archiveName, String qualifiedName, String entryName, String content, int[] mapping) { | ||||
| 	public void saveClassEntry(String s, String s1, String s2, String s3, String s4, int[] mapping) { | ||||
| 		if (mapping != null) { | ||||
| 			differingMappings.put(qualifiedName, mapping); | ||||
| 			differingMappings.put(s2, mapping); | ||||
| 		} | ||||
| 
 | ||||
| 		super.saveClassEntry(path, jarName, qualifiedName, entryName, content); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public void saveClassEntry(String path, String archiveName, String qualifiedName, String entryName, String content) { | ||||
| 		System.err.println("WARNING: Called saveClassEntry without mapping! " + qualifiedName); | ||||
| 
 | ||||
| 		super.saveClassEntry(path, jarName, qualifiedName, entryName, content); | ||||
| 		super.saveClassEntry(s, jarName, s2, s3, s4, mapping); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue