net.fabricmc.tinyremapper.TinyRemapper Java Examples

The following examples show how to use net.fabricmc.tinyremapper.TinyRemapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Patchwork.java    From patchwork-patcher with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void remap(IMappingProvider mappings, Path input, Path output, Path... classpath)
		throws IOException {
	OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(output).build();
	TinyRemapper remapper = null;

	try {
		remapper = remap(mappings, input, outputConsumer, classpath);
		outputConsumer.addNonClassFiles(input, NonClassCopyMode.FIX_META_INF, remapper);
	} finally {
		if (remapper != null) {
			remapper.finish();
		}

		outputConsumer.close();
	}
}
 
Example #2
Source File: RemapUtils.java    From OptiFabric with Mozilla Public License 2.0 6 votes vote down vote up
public static void mapJar(Path output, Path input, IMappingProvider mappings, List<Path> libraries) throws IOException {
	Files.deleteIfExists(output);

	TinyRemapper remapper = TinyRemapper.newRemapper().withMappings(mappings).renameInvalidLocals(true).rebuildSourceFilenames(true).build();

	try {
		OutputConsumerPath outputConsumer = new OutputConsumerPath(output);
		outputConsumer.addNonClassFiles(input);
		remapper.readInputs(input);

		for (Path path : libraries) {
			remapper.readClassPath(path);
		}

		remapper.apply(outputConsumer);
		outputConsumer.close();
		remapper.finish();
	} catch (Exception e) {
		remapper.finish();
		throw new RuntimeException("Failed to remap jar", e);
	}
}
 
Example #3
Source File: Patchwork.java    From patchwork-patcher with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static TinyRemapper remap(IMappingProvider mappings, Path input, BiConsumer<String, byte[]> consumer, Path... classpath) {
	TinyRemapper remapper = TinyRemapper.newRemapper().withMappings(mappings).rebuildSourceFilenames(true).build();

	remapper.readClassPath(classpath);
	remapper.readInputs(input);
	remapper.apply(consumer);

	return remapper;
}