remove hacky mixin refmap remapper
This commit is contained in:
		
							parent
							
								
									e73febd7f4
								
							
						
					
					
						commit
						89d207d06b
					
				
					 3 changed files with 0 additions and 89 deletions
				
			
		|  | @ -51,7 +51,6 @@ public class LoomGradleExtension { | |||
| 	public String refmapName; | ||||
| 	public String loaderLaunchMethod; | ||||
| 	public boolean remapMod = true; | ||||
| 	public boolean remapDependencyMixinRefMaps = true; | ||||
| 	public boolean autoGenIDERuns = true; | ||||
| 	public boolean extractJars = false; | ||||
| 
 | ||||
|  |  | |||
|  | @ -127,85 +127,4 @@ public final class MixinRefmapHelper { | |||
|         }); | ||||
|         return mixinRefmapFilenames; | ||||
|     } | ||||
| 
 | ||||
|     public static boolean transformRefmaps(TinyRemapper remapper, File output) { | ||||
|         Set<String> mixinRefmapFilenames = findRefmaps(output); | ||||
| 
 | ||||
|         if (mixinRefmapFilenames.size() > 0) { | ||||
|             Remapper asmRemapper; | ||||
|             // TODO: Expose in tiny-remapper | ||||
|             try { | ||||
|                 Field f = TinyRemapper.class.getDeclaredField("remapper");; | ||||
|                 f.setAccessible(true); | ||||
|                 asmRemapper = (Remapper) f.get(remapper); | ||||
|             } catch (Exception e) { | ||||
|                 throw new RuntimeException(e); | ||||
|             } | ||||
| 
 | ||||
|             ZipUtil.transformEntries( | ||||
|                     output, | ||||
|                     mixinRefmapFilenames.stream() | ||||
|                             .map((f) -> new ZipEntryTransformerEntry(f, new StringZipEntryTransformer("UTF-8") { | ||||
|                                 @Override | ||||
|                                 protected String transform(ZipEntry zipEntry, String input) throws IOException { | ||||
|                                     return transformRefmap(asmRemapper, GSON, input); | ||||
|                                 } | ||||
|                             })).toArray(ZipEntryTransformerEntry[]::new) | ||||
|             ); | ||||
| 
 | ||||
|             return true; | ||||
|         } else { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static String transformRefmap(Remapper remapper, Gson gson, String input) throws IOException { | ||||
|         try { | ||||
|             JsonObject refMap = gson.fromJson(input, JsonObject.class); | ||||
|             JsonObject mappings = refMap.getAsJsonObject("mappings"); | ||||
| 
 | ||||
|             for (Map.Entry<String, JsonElement> elementEntry : mappings.entrySet()) { | ||||
|                 JsonObject value = elementEntry.getValue().getAsJsonObject(); | ||||
|                 for (String k : new HashSet<>(value.keySet())) { | ||||
|                     try { | ||||
|                         String v = value.get(k).getAsString(); | ||||
|                         String v2; | ||||
| 
 | ||||
|                         if (v.charAt(0) == 'L') { | ||||
|                             // field or member | ||||
|                             MemberInfo info = MemberInfo.parse(v); | ||||
|                             String owner = remapper.map(info.owner); | ||||
|                             if (info.isField()) { | ||||
|                                 v2 = new MemberInfo( | ||||
|                                         remapper.mapFieldName(info.owner, info.name, info.desc), | ||||
|                                         owner, | ||||
|                                         remapper.mapDesc(info.desc) | ||||
|                                 ).toString(); | ||||
|                             } else { | ||||
|                                 v2 = new MemberInfo( | ||||
|                                         remapper.mapMethodName(info.owner, info.name, info.desc), | ||||
|                                         owner, | ||||
|                                         remapper.mapMethodDesc(info.desc) | ||||
|                                 ).toString(); | ||||
|                             } | ||||
|                         } else { | ||||
|                             // class | ||||
|                             v2 = remapper.map(v); | ||||
|                         } | ||||
| 
 | ||||
|                         if (v2 != null) { | ||||
|                             value.addProperty(k, v2); | ||||
|                         } | ||||
|                     } catch (Exception ee) { | ||||
|                         ee.printStackTrace(); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return gson.toJson(refMap); | ||||
|         } catch (Exception e) { | ||||
|             e.printStackTrace(); | ||||
|             return input; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -173,13 +173,6 @@ public class ModProcessor { | |||
| 		if(!output.exists()){ | ||||
| 			throw new RuntimeException("Failed to remap JAR to " + toM + " file not found: " + output.getAbsolutePath()); | ||||
| 		} | ||||
| 
 | ||||
| 		if (extension.remapDependencyMixinRefMaps) { | ||||
| 			if (MixinRefmapHelper.transformRefmaps(remapper, output)) { | ||||
| 				project.getLogger().lifecycle(":remapping " + input.getName() + " (Mixin reference maps)"); | ||||
| 				remapper.finish(); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	static void readInstallerJson(File file, Project project){ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue